Skip to content

Commit

Permalink
Update README about alignment with ultralytics
Browse files Browse the repository at this point in the history
  • Loading branch information
zhiqwang committed Jun 16, 2021
1 parent b1341a0 commit 49cb27c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ model = torch.hub.load('zhiqwang/yolov5-rt-stack', 'yolov5s', pretrained=True)

### Updating checkpoint from ultralytics/yolov5

The module state of `yolort` has some differences comparing to `ultralytics/yolov5`. We can load ultralytics's trained model checkpoint with minor changes, and we have converted ultralytics's release [v3.1](https://github.com/ultralytics/yolov5/releases/tag/v3.1) and [v4.0](https://github.com/ultralytics/yolov5/releases/tag/v4.0). For example, if you want to convert a `yolov5s` (release 4.0) model, you can just run the following script:
The module state of `yolort` has some differences comparing to `ultralytics/yolov5`. We can load ultralytics's trained model checkpoint with minor changes, and we have converted ultralytics's release [v3.1](https://github.com/ultralytics/yolov5/releases/tag/v3.1) and [v4.0](https://github.com/ultralytics/yolov5/releases/tag/v4.0). For example, if you want to convert a `yolov5s` (release 4.0) model, you can just run the following script. You can also see our [how-to-align-with-ultralytics-yolov5](http://github.com/zhiqwang/yolov5-rt-stack/blob/master/notebooks/how-to-align-with-ultralytics-yolov5.ipynb) notebook for more details.

```python
from yolort.utils import update_module_state_from_ultralytics
Expand Down
5 changes: 3 additions & 2 deletions yolort/utils/update_module_state.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,9 @@ def update_module_state_from_ultralytics(
model = torch.hub.load(f'ultralytics/yolov5:{version}', 'custom', path_or_model=custom_path_or_model)

key_arch = f'{arch}_{feature_fusion_type.lower()}_{version}'
assert key_arch in architecture_maps, (
"Currently does't support your architecture, fell free to report a issue to yolort")
if key_arch not in architecture_maps:
raise ValueError("Currently does't supports this architecture, "
"fell free to file an issue labeled enhancement to us")

module_state_updater = ModuleStateUpdate(
arch=architecture_maps[key_arch],
Expand Down

0 comments on commit 49cb27c

Please sign in to comment.