Skip to content

Commit

Permalink
replace download preparation with openmmlab urls
Browse files Browse the repository at this point in the history
  • Loading branch information
xin-li-67 committed Jul 24, 2023
1 parent 43e39b3 commit 9ee9014
Show file tree
Hide file tree
Showing 7 changed files with 21 additions and 12 deletions.
10 changes: 4 additions & 6 deletions projects/uniformer/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,7 @@ export PYTHONPATH=`pwd`:$PYTHONPATH

2. Download Pretrained Weights

In order to either running inferences or training on the `uniformer pose estimation` project, you have to download the original Uniformer pretrained weights on ImageNet1k dataset and the weights trained for the downstream pose estimation task. The original ImageNet1k weights are hosted on SenseTime's [huggingface repository](https://huggingface.co/Sense-X/uniformer_image) and the pose estimation weights can be downloaded according to the [official README](https://github.com/Sense-X/UniFormer/tree/main/pose_estimation)

Once you have the weights downloaded, you can move them to the ideal places and update the corresponding paths in the [config files](./configs/) and the main [uniformer.py](./models/uniformer.py)
To either run inferences or train on the `uniformer pose estimation` project, you have to download the original Uniformer pretrained weights on the ImageNet1k dataset and the weights trained for the downstream pose estimation task. The original ImageNet1k weights are hosted on SenseTime's [huggingface repository](https://huggingface.co/Sense-X/uniformer_image), and the downstream pose estimation task weights are hosted either on Google Drive or Baiduyun. We have uploaded them to the OpenMMLab download URLs, allowing users to use them without burden. For example, you can take a look at [`td-hm_uniformer-b-8xb128-210e_coco-256x192.py`](./configs/td-hm_uniformer-b-8xb128-210e_coco-256x192.py#62), the corresponding pretrained weight URL is already here and when the training or testing process starts, the weight will be automatically downloaded to your device. For the downstream task weights, you can get their URLs from the [benchmark result table](#results).

### Inference

Expand All @@ -46,9 +44,9 @@ For more information on using the inferencer, please see [this document](https:/
Here's an example code:

```shell
python demo/inferencer_demo.py ../../tests/data/coco/000000000785.jpg \
--pose2d ./projects/uniformer/configs/td-hm_uniformer-s-8xb128-210e_coco-256x192.py \
--pose2d-weights $PATH_TO_YOUR_UNIFORMER_top_down_256x192_global_base.pth \
python demo/inferencer_demo.py tests/data/coco/000000000785.jpg \
--pose2d projects/uniformer/configs/td-hm_uniformer-s-8xb128-210e_coco-256x192.py \
--pose2d-weights https://download.openmmlab.com/mmpose/v1/projects/uniformer/top_down_256x192_global_small-d4a7fdac_20230724.pth \
--vis-out-dir vis_results
```

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,9 @@
init_cfg=dict(
# Set the path to pretrained backbone here
type='Pretrained',
checkpoint='${PATH_TO_YOUR_uniformer_small_in1k.pth}')),
checkpoint='https://download.openmmlab.com/mmpose/v1/projects/'
'uniformer/uniformer_base_in1k.pth' # noqa
)),
head=dict(
type='HeatmapHead',
in_channels=512,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,9 @@
init_cfg=dict(
# Set the path to pretrained backbone here
type='Pretrained',
checkpoint='${PATH_TO_YOUR_uniformer_small_in1k.pth}')),
checkpoint='https://download.openmmlab.com/mmpose/v1/projects/'
'uniformer/uniformer_base_in1k.pth' # noqa
)),
head=dict(
type='HeatmapHead',
in_channels=512,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,9 @@
init_cfg=dict(
# Set the path to pretrained backbone here
type='Pretrained',
checkpoint='${PATH_TO_YOUR_uniformer_small_in1k.pth}')),
checkpoint='https://download.openmmlab.com/mmpose/v1/projects/'
'uniformer/uniformer_base_in1k.pth' # noqa
)),
head=dict(
type='HeatmapHead',
in_channels=512,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@
drop_path_rate=0.2,
init_cfg=dict(
type='Pretrained',
checkpoint='${PATH_TO_YOUR_uniformer_small_in1k.pth}')))
checkpoint='https://download.openmmlab.com/mmpose/v1/projects/'
'uniformer/uniformer_small_in1k.pth' # noqa
)))

train_dataloader = dict(batch_size=32)
val_dataloader = dict(batch_size=256)
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@
drop_path_rate=0.2,
init_cfg=dict(
type='Pretrained',
checkpoint='${PATH_TO_YOUR_uniformer_small_in1k.pth}')))
checkpoint='https://download.openmmlab.com/mmpose/v1/projects/'
'uniformer/uniformer_small_in1k.pth' # noqa
)))

train_dataloader = dict(batch_size=128)
val_dataloader = dict(batch_size=256)
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@
drop_path_rate=0.2,
init_cfg=dict(
type='Pretrained',
checkpoint='${PATH_TO_YOUR_uniformer_small_in1k.pth}')))
checkpoint='https://download.openmmlab.com/mmpose/v1/projects/'
'uniformer/uniformer_small_in1k.pth')))

train_dataloader = dict(batch_size=64)
val_dataloader = dict(batch_size=256)

0 comments on commit 9ee9014

Please sign in to comment.