thanif / CPL

MS-Thesis: Proposed a new loss function for estimating Camera Calibration parameters along with a new dataset -- (CVGL Camera Calibration Dataset)
26 stars 3 forks source link

The script about predictions #5

Closed ZhiguoZhao closed 1 year ago

ZhiguoZhao commented 1 year ago

I am not clear about many paths in the code generated with your real data, so I don't know how to convert my pictures into.npy files, and I don't know how to upload my own picture prediction focal length, pitch and other data. So could you please enrich the readme file so that I know more about how you work with the data, which I think might make the whole project more complete.Or could you please give me a script code about predicting real pictures?

thanif commented 1 year ago

Yes, you can use your own pics to get the result as follows:

Left_images = [] Right_images = []

Read left and right image:

l_im = cv2.imread(data_path+folder+"/"+fname, 0) r_im = cv2.imread(datapath+folder+"/"+'RightRGB'+fname.split("_")[1], 0)

Left_images.append(l_im) Right_images.append(r_im)

Save images as npy files:

np.save(path+"li.npy",Left_images) np.save(path+"ri.npy",Right_images)

Load Data:

Left_images = np.load(data_path+"li.npy") Right_images = np.load(data_path+"ri.npy")

Load the weights:

model.load_weights('./new_logs/20221209-143908/model_multi_class/Best/weights_07_486.93.h5')

Test the model:

output = model.predict( x=[Left_images, Right_images], batch_size=16, verbose=1 )

ZhiguoZhao commented 1 year ago

Thank you so much!