models icon indicating copy to clipboard operation
models copied to clipboard

struct2depth training data prep request for documentation

Open saeed68gm opened this issue 7 years ago • 47 comments

Describe the problem

I did not find enough documentation on preparing the data for the training. I am trying to replicate the results for struct2depth on kitti or cityscapes dataset. However, I do not exactly know how to generate the data in the correct format. Mainly, I would like to know how to do the following:

  1. generate the train.txt and valid.txt files for the dataset (currently I am using the script in vid2depth subdir to do that)
  2. How to generate the segmentation results and what is the naming convention used? ( is it using Mask RCNN model? should it be -fseg.png?
  3. It is mentioned that "It is assumed that motion masks are already generated and stored as images". Can you explain how to do this? what is the naming convention and how to generate this?

Thank you for sharing results of your work. This is a really impressive paper and your response is appreciated. @aneliaangelova @VincentCa

System information

  • models/research/struct2depth:
  • Stock code:
  • Centos 7:
  • Tensorflow from binary (pip):
  • v1.11.0-0-gc19e29306c 1.11.0:
  • CUDA 9/CUDNN 7
  • V100 32GB: python gen_data_kitti.py

saeed68gm avatar Feb 08 '19 15:02 saeed68gm

Thank you for your post. We noticed you have not filled out the following field in the issue template. Could you update them if they are relevant in your case, or leave them as N/A? Thanks. What is the top-level directory of the model you are using Have I written custom code OS Platform and Distribution TensorFlow installed from TensorFlow version Bazel version CUDA/cuDNN version GPU model and memory Exact command to reproduce

tensorflowbutler avatar Feb 09 '19 12:02 tensorflowbutler

Have I written custom code: No OS Platform and Distribution: Centos 7 TensorFlow installed from: Binary TensorFlow version: * v1.11.0-0-gc19e29306c 1.11.0 Bazel version: N/A CUDA/cuDNN version: 9.0/7.0 GPU model and memory: Volta V100 32GB Exact command to reproduce: python gen_data_kitti.py or python gen_data_city.py

saeed68gm avatar Feb 09 '19 15:02 saeed68gm

Hi,

  1. Please refer to method compile_file_list in reader.py to understand the structure of the input text files listing individual frame triplets. This function is equivalent to vid2depth's compile_file_list in reader.py. Basically you have a folder path and then a filename (without extension, this is passed as a flag) separated by a single space per line. For every input image you can have accompanying supplemental files, like this:

Input file: 0000.png Related aligned segmentation map: 0000-fseg.png (only needed if you train a motion model) Related camera intrinsics: 0000_cam.txt

The related line in your input text file would look like "some/sub/folder 0000" and your file_extension flag would be "png" in order to read it properly.

  1. We used a pre-trained Mask-RCNN (on a different dataset). Note that the output of running this frame-by-frame gives you instance-level labels for each frame, but they are not temporally consistent, i.e. the same object will almost never have the same instance ID assigned across frames. Use alignment.py to align them, or (preferably) work on a nicer method to make the instance ID's temporally consistent. We call the Mask-RCNN raw output X-seg.png, while we call the aligned ones X-fseg.png. You need to use the latter for the model, it definitely expects aligned labels.

  2. Refer also to 1) and 2); you need to run an instance segmentation model to obtain masks and then perform the alignment. Make sure to save the masks in a lossless image format to avoid compression artifacts compromising the label IDs.

Hope this helps! Vincent

VincentCa avatar Feb 09 '19 21:02 VincentCa

Hi,

@VincentCa

  1. We used a pre-trained Mask-RCNN (on a different dataset) Which dataset? Which Mask-RCNN (backbone)?

Is it possible somehow to reproduce quantitative results from the paper using the released pretrained models? As I understand, it is necessary to use instance segmentation masks in this case.

Thanks!

ramanishka avatar Feb 13 '19 10:02 ramanishka

@VincentCa Thank you for your response. It was very helpful.

it seems like if you set the "handle_motion" flag to true or false, the script will still look for the segmentation mask. So I will put in a workaround to avoid that for now.

For generating the motion masks, is there requirements on the color codes? do we need to encode colors or can we just have rgb codes for every semantic label?

saeed68gm avatar Feb 13 '19 19:02 saeed68gm

@ramanishka For inference, instance segmentation masks are not needed if you are only interested in depth and/or odometry prediction. Only if you want to specifically look at object motion prediction they would be needed to feed the input properly to the object motion estimator network.

@saeed68gm Yes, feel free to just work around that issue. There is no specific requirement on the color codes you use. Just make sure you save the masks in a lossless format (PNG), as I described earlier. Simply assign the same value across all channels. 0 always stands for background, so you can use 1-255 for different object instances across all channels. As I also mentioned, alignment is crucial. For each triplet you provide to the network, it expects to find every instance ID in every subframe also in every neighboring one, and it further expects these to actually corresond to the same object. If within the same triplet an instance ID appears in mask t but not mask t+1, this would be a problem. However, given that segmentation models are not perfect, don't worry if there are some triplets where masks are missing for an object throughout.

VincentCa avatar Feb 13 '19 20:02 VincentCa

@VincentCa Can you share standard training parameters that can be used to replicate result from paper by training model from scratch? Thanks for your help. I have been able to successfully run the training with objection motion mask, and now interested in replicating paper result and then try my own idea.

amanrajdce avatar Mar 03 '19 08:03 amanrajdce

@amanrajdce Please refer to the paper to find the parameter settings we used. If you think some info is missing just let me know. @ferdyandannes You can simply disable using the joint encoder. If you pass --joint_encoder false as a flag, this error shouldn't occur.

VincentCa avatar Mar 04 '19 22:03 VincentCa

@VincentCa

  1. Can you please provide the evaluation script that is used in your repo?
  2. For online refinement process, how do you generate the triplets, can you share the script for the same?
  3. My understanding is the checkpoint model provided with the repo on the project website, is the final model after online-refinement learning right? could you please confirm this.

Thank you very much.

amanrajdce avatar Mar 08 '19 19:03 amanrajdce

The evaluation script is from the SFMLearner work of T. Zhou et al https://github.com/tinghuiz/SfMLearner

aneliaangelova avatar Mar 08 '19 19:03 aneliaangelova

@amanrajdce Please refer to the paper to find the parameter settings we used. If you think some info is missing just let me know.

I am interested in the number of iterations for model training, I can't find this information in paper.

amanrajdce avatar Mar 12 '19 21:03 amanrajdce

@VincentCa Can you give some info about: triplet_list_file="$data_dir/test_files_eigen_triplets.txt" triplet_list_file_remains="$data_dir/test_files_eigen_triplets_remains.txt" in the online-refinement stage? It looks like you use test_files_eigen.txt and generate triplets from it. If my understanding correct? Also, if you have any script for the same can you share if possible?

amanrajdce avatar Mar 12 '19 22:03 amanrajdce

@amanrajdce Have u managed to train this?

lucasjinreal avatar Apr 11 '19 04:04 lucasjinreal

@VincentCa How can MaskRCNN segment Dynamic object? It can only produce instance mask. Maybe the instance is not a dynamic object.Have you considered this issue?

PKUCheng avatar May 02 '19 08:05 PKUCheng

Yes, definitely. We use all masks (of moving and not moving objects) and estimate (meaning learn to estimate) each individual object's motion. If the object is not moving the estimated motion will be 0, which is exactly as desired. During inference no object masks are needed - as you can directly run the depth network only.

aneliaangelova avatar May 02 '19 15:05 aneliaangelova

@amanrajdce Have u managed to train this?

yes, i was able to train this model as well as predict on set of images. However, I wasn't able to run the online refinement stage, due to some lacking information in the paper on how to do it. I have asked the same question from authors on this thread but I haven't got any response yet.

amanrajdce avatar May 04 '19 00:05 amanrajdce

@VincentCa

  1. Can you please provide the evaluation script that is used in your repo?
  2. For online refinement process, how do you generate the triplets, can you share the script for the same?
  3. My understanding is the checkpoint model provided with the repo on the project website, is the final model after online-refinement learning right? could you please confirm this.

Thank you very much.

@aneliaangelova could you please provide some response for 2. and 3. I understand it is not possible to share the code/script but if you can at least talk about the contents of these triplets that is supposed to be there, that will be great.

amanrajdce avatar May 04 '19 00:05 amanrajdce

Hi,

  1. You can refer to the evaluation script of SfMLearner (https://github.com/tinghuiz/SfMLearner) for inspiration on how to evaluate on KITTI. Make sure to replicate normalization steps, crops etc. as described in the paper. The far majority of related work uses the exact same evaluation procedure and parameters (e.g. cut-off at 50/80m, mean alignment), so their implementation might be helpful, too.
  2. See reader.py for reference; triplets can be stored in ordinary image files by stitching seq_length many frames together horizontally. They will be split up and stacked in the channel axis, you can find this in unpack_images(). If you are trying your own dataset, it can certainly be helpful to try different degrees of subsampling (temporally). Ideally, it relates to the same subsampling you applied during training, of course. If, however, the movements are slower/faster during inference, it might be a good idea to adjust, or to implement an adaptive frame rate - because if in a triplet no movement is present at all or it's very subtle, (almost) no training signal will be provided to the network.
  3. No, it is important to note that online-refinement is applied during inference only. We do not ever save checkpoints after running refinement, as the goal is only to allow online-adaption to produce higher-quality inference results, and not to improve the network weights persistently.

VincentCa avatar May 04 '19 00:05 VincentCa

@saeed68gm I am also trying to create a workaround for the "handle_motion" flag not working. Were you able to find a good workaround you could share?

alexbarnett12 avatar May 20 '19 16:05 alexbarnett12

@alexbarnett12 It was not a very clean workaround. I just went into the code and commented everywhere it was using masks.

saeed68gm avatar May 24 '19 03:05 saeed68gm