diff --git a/README.md b/README.md index 75639d6..01da443 100644 --- a/README.md +++ b/README.md @@ -186,7 +186,6 @@ python -m monoloco.run predict docs/frame0032.jpg \ ## C) Orientation and Bounding Box dimensions The network estimates orientation and box dimensions as well. Results are saved in a json file when using the command `--output_types json`. At the moment, the only visualization including orientation is the social distancing one. -
## Training @@ -195,12 +194,12 @@ We train on the KITTI dataset (MonoLoco/Monoloco++/MonStereo) or the nuScenes da Results for MonoLoco++ are obtained with: ``` -python -m monoloco.run train --joints data/arrays/joints-kitti-201202-1743.json --save --monocular +python -m monoloco.run train --joints data/arrays/joints-kitti-201202-1743.json ``` -While for the MonStereo ones just change the input joints and remove the monocular flag: +While for the MonStereo ones just change the input joints and add `--mode stereo` ``` -python3 -m monoloco.run train --joints --save` +python3 -m monoloco.run train --joints data/arrays/joints-kitti-201202-1022.json --mode stereo ``` If you are interested in the original results of the MonoLoco ICCV article (now improved with MonoLoco++), please refer to the tag v0.4.9 in this repository. @@ -244,12 +243,17 @@ python -m openpifpaf.predict \ --checkpoint=shufflenetv2k30 \ --instance-threshold=0.05 --seed-threshold 0.05 --force-complete-pose ``` -Once the step is complete, the below commands transform all the annotations into a single json file that will used for training +Once the step is complete, the below commands transform all the annotations into a single json file that will used for training. +For MonoLoco++: ``` python -m monoloco.run prep --dir_ann ``` -!Add the flag `--monocular` for MonoLoco(++)! + +For MonStereo: +``` +python -m monoloco.run prep --mode stereo --dir_ann +``` ### Collective Activity Dataset To evaluate on of the [collective activity dataset](http://vhosts.eecs.umich.edu/vision//activity-dataset.html) diff --git a/monoloco/eval/generate_kitti.py b/monoloco/eval/generate_kitti.py index e9f0cfe..646b9d5 100644 --- a/monoloco/eval/generate_kitti.py +++ b/monoloco/eval/generate_kitti.py @@ -33,7 +33,8 @@ class GenerateKitti: # Load Network assert args.mode in ('mono', 'stereo'), "mode not recognized" - self.net = 'monstereo' if args.mode == 'mono' else 'monoloco_pp' + self.mode = args.mode + self.net = 'monstereo' if args.mode == 'stereo' else 'monoloco_pp' use_cuda = torch.cuda.is_available() device = torch.device("cuda" if use_cuda else "cpu") self.model = Loco( @@ -153,7 +154,7 @@ class GenerateKitti: print("\nSaved in {} txt {} annotations. Not found {} images".format(cnt_file, cnt_ann, cnt_no_file)) - if self.net == 'monstereo': + if self.baselines[self.mode] and self.net == 'monstereo': print("STEREO:") for key in self.baselines['stereo']: print("Annotations corrected using {} baseline: {:.1f}%".format( diff --git a/monoloco/train/trainer.py b/monoloco/train/trainer.py index cbabbe0..3ee34b1 100644 --- a/monoloco/train/trainer.py +++ b/monoloco/train/trainer.py @@ -85,7 +85,7 @@ class Trainer: self.mt_loss = MultiTaskLoss(losses_tr, losses_val, self.lambdas, self.tasks) self.mt_loss.to(self.device) - if not self.mode == 'stereo': + if self.mode == 'stereo': input_size = 68 output_size = 10 else: