diff --git a/detect.py b/detect.py index 09b45994..b20859b3 100755 --- a/detect.py +++ b/detect.py @@ -25,7 +25,6 @@ parser.add_argument('-img_size', type=int, default=32 * 13, help='size of each i opt = parser.parse_args() print(opt) - def detect(opt): os.system('rm -rf ' + opt.output_folder) os.makedirs(opt.output_folder, exist_ok=True) @@ -66,8 +65,7 @@ def detect(opt): # Get detections with torch.no_grad(): - chip = torch.from_numpy(img).unsqueeze(0).to(device) - pred = model(chip) + pred = model(torch.from_numpy(img).unsqueeze(0).to(device)) pred = pred[pred[:, :, 4] > opt.conf_thres] if len(pred) > 0: diff --git a/train.py b/train.py index 842a56fa..6b44e284 100644 --- a/train.py +++ b/train.py @@ -1,6 +1,5 @@ import argparse import time -import test from models import * from utils.datasets import * @@ -182,6 +181,7 @@ def main(opt): os.system('cp weights/latest.pt weights/backup' + str(epoch) + '.pt') # Calculate mAP + import test test.opt.weights_path = 'weights/latest.pt' mAP = test.main(test.opt)