update readme with pifpaf models

This commit is contained in:
lorenzo 2019-07-04 15:41:56 +02:00
parent 2ef9e833c2
commit e7c9af5578
3 changed files with 12 additions and 15 deletions

View File

@ -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 <model path>`
* 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 <pifpaf model path>`
# Interfaces
@ -114,14 +118,14 @@ Below an example on a generic image from the web, created with:
# Webcam
<img src="docs/webcam_short.gif" height=350 alt="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

View File

@ -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)

View File

@ -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: