NVIDIA / flownet2-pytorch

Pytorch implementation of FlowNet 2.0: Evolution of Optical Flow Estimation with Deep Networks
Other
3.15k stars 741 forks source link

Maintain folder structure of source dataset for the outputted flo files #134

Open fperezgamonal opened 5 years ago

fperezgamonal commented 5 years ago

Hello,

I have run inference on the clean and final passes of MPI-Sintel providing a custom save path (with the --save flag) and noticed that all outputs are written to the same directory instead of keeping the original folder structure with subfolders as: 'alley_1', 'cave_4', etc.

To be precise, I used this command (example with 'clean' pass):

python main.py --inference --model FlowNet2 --save_flow \
--save Results/inference/clean/flownet2 \
--inference_dataset MpiSintelClean \
--inference_dataset_root ../Datasets/MPI-Sintel-complete/training \
--resume weights/FlowNet2_checkpoint.pth.tar

I searched through the issues and I was suprised to not (be able to) found any issue regarding this since it makes visual analysis or computing errors against the ground truth more difficult. Maybe it is possible and I simply used the wrong combination of flags.

Nevertheless, the output file is produced by simply joining the flow_folder

flow_utils.writeFlow( join(flow_folder, '%06d.flo'%(batch_idx * args.inference_batch_size + i)), _pflow)

where flow_folder is the argument passed via --save plus a subfolder (see below) and the _pflow is the actual flow field to save.

if args.save_flow or args.render_validation:
            flow_folder = "{}/inference/{}.epoch-{}-flow-field".format(args.save,args.name.replace('/', '.'),epoch)
            if not os.path.exists(flow_folder):
os.makedirs(flow_folder)

If someone can confirm that this behaviour of keeping the original dataset structure is not possible, I will gladly try to implement it myself as soon as possible since I will need it to compute error metrics, etc for my MsC thesis. As a consequence, I may implement it for more dataset structures (e.g.: 'KITTI2012').

To be clear, the expected output structure inside flow_folder (the final output folder) would be: Screenshot from 2019-03-12 13-33-10

If you need any clarification about what I mean, please do not hesitate to ask. PS: I used Google Colab and I am on the latest update of the branch master.

Regards,

Ferran.

AshviniKSharma commented 5 years ago

hey

Hello,

I have run inference on the clean and final passes of MPI-Sintel providing a custom save path (with the --save flag) and noticed that all outputs are written to the same directory instead of keeping the original folder structure with subfolders as: 'alley_1', 'cave_4', etc.

To be precise, I used this command (example with 'clean' pass):

python main.py --inference --model FlowNet2 --save_flow \
--save Results/inference/clean/flownet2 \
--inference_dataset MpiSintelClean \
--inference_dataset_root ../Datasets/MPI-Sintel-complete/training \
--resume weights/FlowNet2_checkpoint.pth.tar

I searched through the issues and I was suprised to not (be able to) found any issue regarding this since it makes visual analysis or computing errors against the ground truth more difficult. Maybe it is possible and I simply used the wrong combination of flags.

Nevertheless, the output file is produced by simply joining the flow_folder

flow_utils.writeFlow( join(flow_folder, '%06d.flo'%(batch_idx * args.inference_batch_size + i)), _pflow)

where flow_folder is the argument passed via --save plus a subfolder (see below) and the _pflow is the actual flow field to save.

if args.save_flow or args.render_validation:
            flow_folder = "{}/inference/{}.epoch-{}-flow-field".format(args.save,args.name.replace('/', '.'),epoch)
            if not os.path.exists(flow_folder):
os.makedirs(flow_folder)

If someone can confirm that this behaviour of keeping the original dataset structure is not possible, I will gladly try to implement it myself as soon as possible since I will need it to compute error metrics, etc for my MsC thesis. As a consequence, I may implement it for more dataset structures (e.g.: 'KITTI2012').

To be clear, the expected output structure inside flow_folder (the final output folder) would be: Screenshot from 2019-03-12 13-33-10

If you need any clarification about what I mean, please do not hesitate to ask. PS: I used Google Colab and I am on the latest update of the branch master.

Regards,

Ferran.

Hey, I want to obtain the result for some set of images but can you help me in doing that. I ran inference for ImagesFromeFolder but I am getting three folders namely Inference, train and validation, but none of them contain resulting Optical flow. Can you help me in getting that?

davinca commented 5 years ago

@fperezgamonal did u solve the issue that the outputs could maintain the original dataset structure?

davinca commented 5 years ago

I have solved it by modifying the main.py file, thanks!