Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix the models.py parameters #384

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Use_yolov4_to_train_your_own_data.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,9 @@ tensorboard --logdir log --host 192.168.212.75 --port 6008
# 5. 验证

```
python model.py 3 weight/Yolov4_epoch166_coins.pth data/coin2.jpg data/coins.names
python models.py 3 weight/Yolov4_epoch166_coins.pth data/coin2.jpg 608 608 data/coins.names

python model.py num_classes weightfile imagepath namefile
python models.py num_classes weightfile imagepath height width namefile
```
coins.names
```
Expand Down
7 changes: 4 additions & 3 deletions models.py
Original file line number Diff line number Diff line change
Expand Up @@ -464,12 +464,12 @@ def forward(self, input):
n_classes = int(sys.argv[1])
weightfile = sys.argv[2]
imgfile = sys.argv[3]
height = sys.argv[4]
height = int(sys.argv[4])
width = int(sys.argv[5])
namesfile = int(sys.argv[6])
namesfile = sys.argv[6]
else:
print('Usage: ')
print(' python models.py num_classes weightfile imgfile namefile')
print(' python models.py num_classes weightfile imgfile height width namefile')

model = Yolov4(yolov4conv137weight=None, n_classes=n_classes, inference=True)

Expand All @@ -487,6 +487,7 @@ def forward(self, input):
# Optional inference sizes:
# Hight in {320, 416, 512, 608, ... 320 + 96 * n}
# Width in {320, 416, 512, 608, ... 320 + 96 * m}
print(width, height)
sized = cv2.resize(img, (width, height))
sized = cv2.cvtColor(sized, cv2.COLOR_BGR2RGB)

Expand Down