This commit is contained in:
Glenn Jocher 2018-11-21 18:01:18 +01:00
parent 4eed25dad0
commit 4e4b67b3c5
2 changed files with 2 additions and 4 deletions

View File

@ -25,7 +25,6 @@ parser.add_argument('-img_size', type=int, default=32 * 13, help='size of each i
opt = parser.parse_args() opt = parser.parse_args()
print(opt) print(opt)
def detect(opt): def detect(opt):
os.system('rm -rf ' + opt.output_folder) os.system('rm -rf ' + opt.output_folder)
os.makedirs(opt.output_folder, exist_ok=True) os.makedirs(opt.output_folder, exist_ok=True)
@ -66,8 +65,7 @@ def detect(opt):
# Get detections # Get detections
with torch.no_grad(): with torch.no_grad():
chip = torch.from_numpy(img).unsqueeze(0).to(device) pred = model(torch.from_numpy(img).unsqueeze(0).to(device))
pred = model(chip)
pred = pred[pred[:, :, 4] > opt.conf_thres] pred = pred[pred[:, :, 4] > opt.conf_thres]
if len(pred) > 0: if len(pred) > 0:

View File

@ -1,6 +1,5 @@
import argparse import argparse
import time import time
import test
from models import * from models import *
from utils.datasets import * from utils.datasets import *
@ -182,6 +181,7 @@ def main(opt):
os.system('cp weights/latest.pt weights/backup' + str(epoch) + '.pt') os.system('cp weights/latest.pt weights/backup' + str(epoch) + '.pt')
# Calculate mAP # Calculate mAP
import test
test.opt.weights_path = 'weights/latest.pt' test.opt.weights_path = 'weights/latest.pt'
mAP = test.main(test.opt) mAP = test.main(test.opt)