From e7c9af5578b46be0c57e36f95f43479673c62a35 Mon Sep 17 00:00:00 2001 From: lorenzo Date: Thu, 4 Jul 2019 15:41:56 +0200 Subject: [PATCH] update readme with pifpaf models --- README.md | 14 +++++++++----- src/main.py | 7 +++---- src/predict/pifpaf.py | 6 ------ 3 files changed, 12 insertions(+), 15 deletions(-) diff --git a/README.md b/README.md index 5d06acd..0f1999b 100644 --- a/README.md +++ b/README.md @@ -52,9 +52,13 @@ mkdir arrays models kitti nuscenes logs ### Pre-trained Models * Download a MonoLoco pre-trained model from -[Google Drive](https://drive.google.com/open?id=1F7UG1HPXGlDD_qL-AN5cv2Eg-mhdQkwv) and save it in `data/models` -* Download a Pifpaf pre-trained model from [openpifpaf](https://github.com/vita-epfl/openpifpaf) project -and save it into `data/models` +[Google Drive](https://drive.google.com/open?id=1F7UG1HPXGlDD_qL-AN5cv2Eg-mhdQkwv) and save it in `data/models` +(default) or in any folder and call it through the command line option `--model ` +* Pifpaf pre-trained model will be automatically downloaded at the first run. +Three standard, pretrained models are available when using the command line option +`--checkpoint resnet50`, `--checkpoint resnet101` and `--checkpoint resnet152`. +Alternatively, you can download a Pifpaf pre-trained model from [openpifpaf](https://github.com/vita-epfl/openpifpaf) + and call it with `--checkpoint ` # Interfaces @@ -114,14 +118,14 @@ Below an example on a generic image from the web, created with: # Webcam example image -MonoLoco can run on personal computers with no GPU and low resolution images (e.g. 256x144). +MonoLoco can run on personal computers with only CPU and low resolution images (e.g. 256x144) at ~2fps. It support 3 types of visualizations: `front`, `bird` and `combined` Multiple visualizations can be combined in different windows. The above gif has been obtained running on a Macbook the command: -`python src/main.py predict --webcam --scale 0.2 --output_types combined --z_max 10` +`python src/main.py predict --webcam --scale 0.2 --output_types combined --z_max 10 --checkpoint resnet50` # Preprocess diff --git a/src/main.py b/src/main.py index 92da185..ad04eaa 100644 --- a/src/main.py +++ b/src/main.py @@ -39,7 +39,7 @@ def cli(): default='data/nuscenes/') # Predict (2D pose and/or 3D location from images) - # 0) General arguments + # General predict_parser.add_argument('--networks', nargs='+', help='Run pifpaf and/or monoloco', default=['monoloco']) predict_parser.add_argument('images', nargs='*', help='input images') predict_parser.add_argument('--glob', help='glob expression for input images (for many images)') @@ -49,13 +49,12 @@ def cli(): 'json bird front combined for Monoloco') predict_parser.add_argument('--show', help='to show images', action='store_true') - # 1)Pifpaf arguments + # Pifpaf nets.cli(predict_parser) decoder.cli(predict_parser, force_complete_pose=True, instance_threshold=0.1) - predict_parser.add_argument('--checkpoint', help='pifpaf model to load') predict_parser.add_argument('--scale', default=1.0, type=float, help='change the scale of the image to preprocess') - # 2) Monoloco argument + # Monoloco predict_parser.add_argument('--model', help='path of MonoLoco model to load', default="data/models/monoloco-190513-1437.pkl") predict_parser.add_argument('--hidden_size', type=int, help='Number of hidden units in the model', default=256) diff --git a/src/predict/pifpaf.py b/src/predict/pifpaf.py index 980577a..779a132 100644 --- a/src/predict/pifpaf.py +++ b/src/predict/pifpaf.py @@ -47,12 +47,6 @@ def factory_from_args(args): # Merge the model_pifpaf argument if not args.checkpoint: args.checkpoint = 'resnet152' # Default model Resnet 152 - elif args.checkpoint == 'resnet50': - args.checkpoint = 'data/models/resnet50block5-pif-paf-edge401-190424-122009-f26a1f53.pkl' - elif args.checkpoint == 'resnet101': - args.checkpoint = 'data/models/resnet101block5-pif-paf-edge401-190412-151013-513a2d2d.pkl' - elif args.checkpoint == 'resnet152': - args.checkpoint = 'data/models/resnet152block5-pif-paf-edge401-190412-121848-8d771fcc.pkl' # glob if not args.webcam: if args.glob: