Jackie-Chou / MC-CNN-python

a python implementation of MC-CNN
MIT License
47 stars 19 forks source link

Can you give more details about the parameters ? #2

Closed hurricane2018 closed 5 years ago

hurricane2018 commented 5 years ago

Hi, thank you for your wonderful work and code. However, when I run the "python match.py", the error occurs. Could you give more details about the parameters including data_dir, save_dir, t, s, and e?

======== parser.add_argument("--data_dir", type=str, required=True, help="path to root dir to data.") parser.add_argument("--save_dir", type=str, required=True, help="path to root dir to save results") parser.add_argument("-t", "--tag", type=str, required=True, help="tag used to indicate one run") parser.add_argument("-s", "--start", type=int, required=True, help="index of first image to do matching,\ this is used for parallel matching of different images") parser.add_argument("-e", "--end", type=int, required=True, help="index of last image to do matching")

Thank you very much !

Jackie-Chou commented 5 years ago

Hi, sorry for the unclear explanation of the parameters. Here’s more detailed interpretation:

data_dir: this is the root directory of the input data/images. save_dir: this is the root directory to save out files. These two parameters are a little bit tricky. As you may see in match.py, I use string.replace method to produce the paths for output files from input image paths. The data_dir is generally a common prefix for all input image paths, and it is replaced by save_dir prefix to make the output file paths.

tag: this is just a small token used to identify one particular execution of match.py. As you can see in match.py Line-69,70, tag is inserted into the submission directory paths and create the according directories.

To be more clear, here’s one specific example. As you may see in data/list/train_all.txt my input image paths. Now I set data_dir to “/scratch/xz/MC-CNN-python/data/MiddEval3” and save_dir to “/scratch/xz/MC-CNN-python/data/result”, and I set tag to “abc”.

Then in match.py line-69 and line-70 we have: save_res_dir = /scratch/xz/MC-CNN-python/data/result/submit_abc   save_img_dir = /scratch/xz/MC-CNN-python/data/result/submit_abc_imgs

Assume now the input left image is from path “/scratch/xz/MC-CNN-python/data/MiddEval3/trainingH/Playtable/im0.png” Then as line-99 to line-103 we have: res_dir = “/scratch/xz/MC-CNN-python/data/result/submit_abc/trainingH/Playtable” img_dir = “/scratch/xz/MC-CNN-python/data/result/submit_abc_imgs/trainingH/Playtable”

Then as line-108 to line-110 we have: out_path = “/scratch/xz/MC-CNN-python/data/result/submit_abc/trainingH/Playtable/disp0MCCNN.pfm” out_time_path = “/scratch/xz/MC-CNN-python/data/result/submit_abc/trainingH/Playtable/timeMCCNN.txt” out_img_path = “/scratch/xz/MC-CNN-python/data/result/submit_abc/trainingH/Playtable/disp0MCCNN.pgm”

The above three files are the actual output files. I recommend you to read code in match.py from line-64 to line-100 about details of these paths.

start, end: these are used to control match.py to only process a subset of input images. The subset starts from index “start” to index “end”. For example, setting start=1 and end=2 means to only process image No.1 and No.2. You can parallelize processing for different images by dividing all images into multiple subsets and run them simultaneously.

Hope this can be helpful. Best regards.

Jackie Chou

发送自 Windows 10 版邮件应用

发件人: hurricane2018 发送时间: 2018年12月18日 20:21 收件人: Jackie-Chou/MC-CNN-python 抄送: Subscribed 主题: [Jackie-Chou/MC-CNN-python] Can you give more details about theparameters ? (#2)

Hi, thank you for your wonderful work and code. However, when I run the "python match.py", the error occurs. Could you give more details about the parameters including data_dir, save_dir, t, s, and e?

parser.add_argument("--data_dir", type=str, required=True, help="path to root dir to data.") parser.add_argument("--save_dir", type=str, required=True, help="path to root dir to save results") parser.add_argument("-t", "--tag", type=str, required=True, help="tag used to indicate one run") parser.add_argument("-s", "--start", type=int, required=True, help="index of first image to do matching, this is used for parallel matching of different images") parser.add_argument("-e", "--end", type=int, required=True, help="index of last image to do matching") Thank you very much ! — You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or mute the thread.

hurricane2018 commented 5 years ago

Thank you for your reply.

hurricane2018 commented 5 years ago

In addition, I found it's hard to fully understand the functions, such as cost_volume_aggregation, SGM_average, and semi_global matching, in ' process_functional.py '.

Do you have any other materials for understanding these functions? Thank you very much!

Jackie-Chou commented 5 years ago

You are right. I have indeed included a pretrained model in data/tensorboard_log. You can load it by setting “--resume data/tensorboard_log/model_epoch2000.ckpt”. But please note that I didn’t upload the raw Middlebury data since it’s too large, you may download it from the official website and save it to data/.

Best regards Jackie Chou

发送自 Windows 10 版邮件应用

发件人: hurricane2018 发送时间: 2018年12月19日 17:26 收件人: Jackie-Chou/MC-CNN-python 抄送: Jackie Chou; Comment 主题: Re: [Jackie-Chou/MC-CNN-python] Can you give more details about theparameters ? (#2)

Thank you for your reply. In addition, I am not familiar with Tensorflow. I think you have used the already trained model when you run "python match.py". Did you upload your model? I guess I can set the resume parameter. parser.add_argument("--resume", type=str, default=None, help="path to checkpoint to resume from. if None(default), model is initialized using default methods") How should I set the parameter? — You are receiving this because you commented. Reply to this email directly, view it on GitHub, or mute the thread.

Jackie-Chou commented 5 years ago

You’d better to fully understand how the whole process of MC-CNN works before you go through my code. The origin MC-CNN paper is quite a well-written one, so I suggest to read it carefully and thoroughly.

Best regards Jackie Chou

发送自 Windows 10 版邮件应用

发件人: hurricane2018 发送时间: 2018年12月19日 20:32 收件人: Jackie-Chou/MC-CNN-python 抄送: Jackie Chou; Comment 主题: Re: [Jackie-Chou/MC-CNN-python] Can you give more details about theparameters ? (#2)

In addition, I found it's hard to fully understand the functions, such as cost_volume_aggregation, SGM_average, and semi_global matching, in ' process_functional.py '. Do you have any other materials for understanding these functions? Thank you very much! — You are receiving this because you commented. Reply to this email directly, view it on GitHub, or mute the thread.

hurricane2018 commented 5 years ago

Thank you for your advice.

Best!