Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/open-mmlab/mmdeploy into …
Browse files Browse the repository at this point in the history
…sb/fix_run_python36
  • Loading branch information
SemyonBevzuk committed Feb 8, 2022
2 parents 1a1ebd7 + cce81d3 commit bd71b45
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 8 deletions.
2 changes: 1 addition & 1 deletion docs/en/tutorials/how_to_install_mmdeploy_on_jetsons.md
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ cmake --version
### Install mmdeploy
Just follow the instruction [here](../build.md). If it throws `failed building wheel for numpy...ERROR: Failed to build one or more wheels` when installing `h5py`, try install `h5py` manually.
```
sudo apt-get install pkd-config libhdf5-100 libhdf5-dev
sudo apt-get install pkg-config libhdf5-100 libhdf5-dev
pip install versioned-hdf5 --no-cache-dir
```

Expand Down
6 changes: 4 additions & 2 deletions mmdeploy/backend/onnxruntime/wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class ORTWrapper(BaseWrapper):
>>> import torch
>>>
>>> onnx_file = 'model.onnx'
>>> model = ORTWrapper(onnx_file, -1)
>>> model = ORTWrapper(onnx_file, 'cpu')
>>> inputs = dict(input=torch.randn(1, 3, 224, 224, device='cpu'))
>>> outputs = model(inputs)
>>> print(outputs)
Expand Down Expand Up @@ -79,7 +79,9 @@ def forward(self, inputs: Dict[str,
input_tensor = input_tensor.contiguous()
if not self.is_cuda_available:
input_tensor = input_tensor.cpu()
element_type = input_tensor.numpy().dtype
# Avoid unnecessary data transfer between host and device
element_type = input_tensor.new_zeros(
1, device='cpu').numpy().dtype
self.io_binding.bind_input(
name=name,
device_type=self.device_type,
Expand Down
2 changes: 1 addition & 1 deletion mmdeploy/codebase/mmcls/deploy/classification_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ def forward_test(self, imgs: torch.Tensor, *args, **kwargs) -> \
def show_result(self,
img: np.ndarray,
result: list,
win_name: str,
win_name: str = '',
show: bool = True,
out_file: str = None):
"""Show predictions of classification.
Expand Down
8 changes: 7 additions & 1 deletion mmdeploy/codebase/mmocr/deploy/mmocr.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import mmcv
import torch
from mmcv.utils import Registry
from packaging import version
from torch.utils.data import DataLoader, Dataset

from mmdeploy.codebase.base import CODEBASE, BaseTask, MMCodebase
Expand Down Expand Up @@ -137,6 +138,11 @@ def single_gpu_test(model: torch.nn.Module,
Returns:
list: The prediction results.
"""
from mmdet.apis import single_gpu_test
import mmocr
# fixed the bug when using `--show-dir` after mocr v0.4.1
if version.parse(mmocr.__version__) < version.parse('0.4.1'):
from mmdet.apis import single_gpu_test
else:
from mmocr.apis import single_gpu_test
outputs = single_gpu_test(model, data_loader, show, out_dir, **kwargs)
return outputs
2 changes: 1 addition & 1 deletion mmdeploy/codebase/mmocr/deploy/text_detection_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ def forward_test(self, imgs: torch.Tensor, *args, **kwargs) -> \
def show_result(self,
img: np.ndarray,
result: dict,
win_name: str,
win_name: str = '',
show: bool = True,
score_thr: float = 0.3,
out_file: str = None):
Expand Down
2 changes: 1 addition & 1 deletion mmdeploy/codebase/mmocr/deploy/text_recognition_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ def forward_test(self, imgs: torch.Tensor,
def show_result(self,
img: np.ndarray,
result: list,
win_name: str,
win_name: str = '',
show: bool = True,
score_thr: float = 0.3,
out_file: str = None):
Expand Down
2 changes: 1 addition & 1 deletion requirements/optional.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
mmcls>=0.15.0
mmcls>=0.15.0,<=0.19.0
mmdet>=2.19.0
mmedit
mmocr==0.3.0
Expand Down

0 comments on commit bd71b45

Please sign in to comment.