yzcjtr / GeoNet

Code for GeoNet: Unsupervised Learning of Dense Depth, Optical Flow and Camera Pose (CVPR 2018)
MIT License
723 stars 181 forks source link

about flow_test. #62

Closed Chenxi93 closed 4 years ago

Chenxi93 commented 4 years ago

When I run the eval_flow.py. I got 'module' object has no attribute 'CV_LOAD_IMAGE_UNCHANGED'. It seems that OpenCV 3.20 has renamed the flag. So I changed it to cv2.IMREAD_UNCHANGED. I got the images but with a None Object at the end.

` [[ 0 32768 32768]

[ 0 32768 32768] [ 0 32768 32768] ... [ 0 32768 32768] [ 0 32768 32768] [ 0 32768 32768]]] None Traceback (most recent call last): File "kitti_eval/eval_flow.py", line 61, in main() File "kitti_eval/eval_flow.py", line 34, in main pred_flow = fl.read_flow(pred_flow_fn) File "/home/chenxigeng/GeoNet/kitti_eval/flow_tool/flowlib.py", line 97, in read_flow flow = read_kitti_png_file(filename) File "/home/chenxigeng/GeoNet/kitti_eval/flow_tool/flowlib.py", line 656, in read_kitti_png_file flow_img = flow_img.astype(float) AttributeError: 'NoneType' object has no attribute 'astype' `

I printed the shape of flow_img. It was (375, 1242, 3) (375, 1242, 3) and the type it was <type 'numpy.ndarray'> <type 'numpy.ndarray'> <type 'NoneType'> I don't know why there is a third type NoneType..

I would like to know which version of Opencv have you used?

After this I also want to use your code to process my own live videos (captured by a camera), I saw the previous Issues that you saw with cv2.imwrite. So the live videos should also first written as many frames and then create the scripts like the examples at the same time?

yzcjtr commented 4 years ago

The issue mainly results from the image io of opencv I guess. Can you try the code with opencv 2.4.13 (the version we used)?

Yes, you need to preprocess your video into frame snippets as we did.