Skip to content

Commit

Permalink
Lightweight openpose fixes (#242)
Browse files Browse the repository at this point in the history
* Fixed onnx optimize bugs with half precision and different number of stages

* Fixed height check based on [original repo #202](Daniil-Osokin/lightweight-human-pose-estimation.pytorch#202)

* Update changelog for #242
  • Loading branch information
tsampazk authored Mar 11, 2022
1 parent 47ad668 commit 280db6c
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
4 changes: 3 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,12 @@ Released on XX, XXth, 2022.
- `panoptic_segmentation/efficient_ps`: updated dataset preparation scripts to create correct validation ground truth ([#221](https://github.com/opendr-eu/opendr/pull/221)).
- `panoptic_segmentation/efficient_ps`: added specific configuration files for the provided pretrained models ([#221](https://github.com/opendr-eu/opendr/pull/221)).
- `c_api/face_recognition`: pass key by const reference in `json_get_key_string()` ([#221](https://github.com/opendr-eu/opendr/pull/221)).
- `pose_estimation/lightweight_open_pose`: fixed height check on transformations.py according to original tool repo ([#242](https://github.com/opendr-eu/opendr/pull/242)).
- `pose_estimation/lightweight_open_pose`: fixed two bugs where ONNX optimization failed on specific learner parameterization ([#242](https://github.com/opendr-eu/opendr/pull/242)).
- Dependency Updates:
- `heart anomaly detection`: upgraded scikit-learn runtime dependency from 0.21.3 to 0.22 ([#198](https://github.com/opendr-eu/opendr/pull/198)).
- Relaxed all dependencies to allow future versions of non-critical tools to be used ([#201](https://github.com/opendr-eu/opendr/pull/201)).


## Version 1.0
Released on December 31st, 2021.
Released on December 31st, 2021.
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ def __call__(self, sample):
if image_y_start < 0:
crop_y_start -= image_y_start
image_y_start = 0
if image_y_start >= w:
if image_y_start >= h:
should_crop = False

if image_x_finish > w:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -860,9 +860,14 @@ def __convert_to_onnx(self, output_name, do_constant_folding=False, verbose=Fals
inp = torch.randn(1, 3, self.base_height, width).cuda()
else:
inp = torch.randn(1, 3, self.base_height, width)
if self.half:
inp = inp.half()
input_names = ['data']
output_names = ['stage_0_output_1_heatmaps', 'stage_0_output_0_pafs',
'stage_1_output_1_heatmaps', 'stage_1_output_0_pafs']
if self.num_refinement_stages == 2:
output_names = ['stage_0_output_1_heatmaps', 'stage_0_output_0_pafs',
'stage_1_output_1_heatmaps', 'stage_1_output_0_pafs']
else:
output_names = ['stage_0_output_1_heatmaps', 'stage_0_output_0_pafs']

torch.onnx.export(self.model, inp, output_name, verbose=verbose, enable_onnx_checker=True,
do_constant_folding=do_constant_folding, input_names=input_names, output_names=output_names,
Expand Down

0 comments on commit 280db6c

Please sign in to comment.