diff --git a/test.py b/test.py index 25ce611e..efb260aa 100644 --- a/test.py +++ b/test.py @@ -176,7 +176,7 @@ def test( if __name__ == '__main__': parser = argparse.ArgumentParser(prog='test.py') - parser.add_argument('--batch-size', type=int, default=32, help='size of each image batch') + parser.add_argument('--batch-size', type=int, default=3, help='size of each image batch') parser.add_argument('--cfg', type=str, default='cfg/yolov3-spp.cfg', help='cfg file path') parser.add_argument('--data-cfg', type=str, default='data/coco.data', help='coco.data file path') parser.add_argument('--weights', type=str, default='weights/yolov3-spp.weights', help='path to weights file') diff --git a/utils/gcp.sh b/utils/gcp.sh index 19785dc2..3aed2db7 100755 --- a/utils/gcp.sh +++ b/utils/gcp.sh @@ -10,8 +10,8 @@ sudo reboot now # Re-clone sudo rm -rf yolov3 -# git clone https://github.com/ultralytics/yolov3 # master -git clone -b test --depth 1 https://github.com/ultralytics/yolov3 yolov3_test # branch +git clone https://github.com/ultralytics/yolov3 # master +# git clone -b test --depth 1 https://github.com/ultralytics/yolov3 yolov3_test # branch cp -r weights yolov3 cp -r cocoapi/PythonAPI/pycocotools yolov3 cd yolov3 @@ -50,6 +50,7 @@ git clone https://github.com/ultralytics/yolov3 # master cp -r weights yolov3 cp -r cocoapi/PythonAPI/pycocotools yolov3 cd yolov3 +python3 test.py --save-json git pull https://github.com/ultralytics/yolov3 python3 train.py --data-cfg data/coco_1img.data diff --git a/utils/utils.py b/utils/utils.py index 65d3adec..91ac10cf 100755 --- a/utils/utils.py +++ b/utils/utils.py @@ -284,7 +284,7 @@ def compute_loss(p, targets): # predictions, targets def build_targets(model, targets): # targets = [image, class, x, y, w, h] - if isinstance(model, nn.parallel.DistributedDataParallel): + if type(model) in (nn.parallel.DataParallel, nn.parallel.DistributedDataParallel): model = model.module txy, twh, tcls, indices = [], [], [], [] @@ -523,7 +523,7 @@ def plot_results(start=0, stop=0): # from utils.utils import *; plot_results() x = range(start, min(stop, n) if stop else n) for i in range(10): plt.subplot(2, 5, i + 1) - plt.plot(x, results[i, x].clip(max=500), marker='.', label=f.replace('.txt','')) + plt.plot(x, results[i, x].clip(max=500), marker='.', label=f.replace('.txt', '')) plt.title(s[i]) if i == 0: plt.legend()