Closed Lane689 closed 2 years ago
'2' here refers to two different depth estimates by two different neural networks --- one trained on mostly indoor images, and the other on outdoor images. Check the comment here --- so you can use any one (the second one is being used in gen.py
).
Yes, there is no strict requirement to have an h5 file as long as you can load the image, depth and segmentation information. Check use_preproc_bg.py
for an example.
Okay thanks.
@ankush-me What function or something else do I need to use if imwrite()
won't work with this data shape (2,x,y)? I can't extract depth images from h5 file.
Do I need separate indoor and outdoor estimations or what? Or can I save directly images from h5 file. I don't understand how to extract 2 diff depth estimations, how to save images in folder. Can't find anywhere.
I try to reorder width, height and channel from (C,W,H) to (W,H,C) and still gives me an error:
Traceback (most recent call last):
File "C:\Users\Leon\Desktop\Synthtext dataset\SynthText\bg_data\mojeSpremanjeDepth.py", line 23, in <module>
cv2.imwrite(f"{save_dir}/{imagename}", IMAGE_arr)
cv2.error: OpenCV(4.5.4-dev) D:\a\opencv-python\opencv-python\opencv\modules\imgcodecs\src\loadsave.cpp:735: error: (-215:Assertion failed) image.channels() == 1 || image.channels() == 3 || image.channels() == 4 in function 'cv::imwrite_'
@ankush-me Hi, what is this shape means? When I print dtype and shape from depth.h5 this shows me: float32 (2, 600, 400) float32 (2, 600, 493) float32 (2, 600, 284)
The second and third ones are height and width? But what is 2? Because of that I can't imwrite( ) images into a folder while images from seg.h5 I successfully saved in a folder. Opencv's imwrite expects (height, width, channels).
I try to extract images from h5 files into different folders and then directly put them into the script? What you say, will this work?