CADepth-master
CADepth-master copied to clipboard
Faster training compared to Monodepth2
Hi and thanks for sharing your code online!
When training my own models and comparing with the Monodepth2 framework, I noticed that CADepth-Net takes significantly less time to train with all parameters being the same - number of layers, epochs, type of training data, hardware. For example, 6h53m for 20 epochs on monocular data with ResNet18 for both depth and pose. My MonoDepth model with the same settings took 11h19m, consistently over several tests. To my understanding, you essentially took the Monodepth2 code and then added the SPM and DEM, so I wonder how that results in reduced training time. Do you have an idea why this might be?
For faster image preprocessing, we use opencv+albumentations instead of pil+ torchvision which Monodepth2 uses, you can see datasets/mono_dataset.py for more details. And you can see this experiments for speed comparison.
Thanks for the fast reply! Since according to the link you shared, cv2.imread is a lot slower than PIL.Image.open, I suppose the main load during training comes from other things where albumentations gives a speed boost, like image flipping and other data augmentation stuff. I have another question though: My Monodepth2 model took 11h23 with ResNet50 and 11h19 with ResNet18 -- barely any difference. CADepth-Net however took 10h11 with ResNet50 and 6h53 with ResNet18. I wonder how one model is almost invariant to the encoder size and the other one not?
we haven't compared the training time between the MonoDepth2 and CADepth-Net with different encoder, but i think you can use some tools, like lineprofiler, to check the running speed for encoder, decoder and so on.