Skip to content

Commit

Permalink
README update
Browse files Browse the repository at this point in the history
  • Loading branch information
jeffxtang authored and IvanKobzarev committed Jan 27, 2021
1 parent 45093c2 commit 1e8213f
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions ObjectDetection/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,19 +21,19 @@ If you don't have the PyTorch environment set up to run the script, you can down

The Python script `export.py` in the `models` folder of the [YOLOv5 repo](https://github.com/ultralytics/yolov5) is used to generate a TorchScript-formatted YOLOv5 model named `yolov5s.torchscript.pt` for mobile apps.

Open a Mac/Linux/Windows Terminal, run the following commands:
Open a Mac/Linux/Windows Terminal, run the following commands (note that we use the fork of the original YOLOv5 repo to make sure the code changes work, but feel free to use the original repo):

```
git clone https://github.com/ultralytics/yolov5
git clone https://github.com/jeffxtang/yolov5
cd yolov5
pip install -r requirements.txt
```

Then edit `models/export.py` to make two changes:

* Change the line `model.model[-1].export = True` to `model.model[-1].export = False`
* Change the line 50 from `model.model[-1].export = True` to `model.model[-1].export = False`

* Add the following two lines of model optimization code between `ts = torch.jit.trace(model, img)` and `ts.save(f)`:
* Add the following two lines of model optimization code after line 57, between `ts = torch.jit.trace(model, img)` and `ts.save(f)`:

```
from torch.utils.mobile_optimizer import optimize_for_mobile
Expand Down

0 comments on commit 1e8213f

Please sign in to comment.