mAP corrected to per-class
This commit is contained in:
parent
e7dab5a42f
commit
cd753d23f7
7
test.py
7
test.py
|
@ -8,7 +8,7 @@ parser = argparse.ArgumentParser()
|
||||||
parser.add_argument('-batch_size', type=int, default=32, help='size of each image batch')
|
parser.add_argument('-batch_size', type=int, default=32, help='size of each image batch')
|
||||||
parser.add_argument('-cfg', type=str, default='cfg/yolov3.cfg', help='path to model config file')
|
parser.add_argument('-cfg', type=str, default='cfg/yolov3.cfg', help='path to model config file')
|
||||||
parser.add_argument('-data_config_path', type=str, default='cfg/coco.data', help='path to data config file')
|
parser.add_argument('-data_config_path', type=str, default='cfg/coco.data', help='path to data config file')
|
||||||
parser.add_argument('-weights_path', type=str, default='checkpoints/yolov3.pt', help='path to weights file')
|
parser.add_argument('-weights_path', type=str, default='checkpoints/yolov3.weights', help='path to weights file')
|
||||||
parser.add_argument('-class_path', type=str, default='data/coco.names', help='path to class label file')
|
parser.add_argument('-class_path', type=str, default='data/coco.names', help='path to class label file')
|
||||||
parser.add_argument('-iou_thres', type=float, default=0.5, help='iou threshold required to qualify as detected')
|
parser.add_argument('-iou_thres', type=float, default=0.5, help='iou threshold required to qualify as detected')
|
||||||
parser.add_argument('-conf_thres', type=float, default=0.5, help='object confidence threshold')
|
parser.add_argument('-conf_thres', type=float, default=0.5, help='object confidence threshold')
|
||||||
|
@ -117,11 +117,10 @@ for batch_i, (imgs, targets) in enumerate(dataloader):
|
||||||
# Compute mean AP for this image
|
# Compute mean AP for this image
|
||||||
mAP = AP.mean()
|
mAP = AP.mean()
|
||||||
|
|
||||||
# Append image mAP to list of validation mAPs
|
# Append image mAP to list
|
||||||
mAPs.append(mAP)
|
|
||||||
|
|
||||||
# Print image mAP and running mean mAP
|
# Print image mAP and running mean mAP
|
||||||
print('+ Sample [%d/%d] AP: %.4f (%.4f)' % (len(mAPs), len(dataloader) * opt.batch_size, AP, np.mean(mAPs)))
|
print('+ Sample [%d/%d] AP: %.4f (%.4f)' % (len(mAPs), len(dataloader) * opt.batch_size, mAP, np.mean(mAPs)))
|
||||||
|
|
||||||
|
|
||||||
print('Mean Average Precision: %.4f' % np.mean(mAPs))
|
print('Mean Average Precision: %.4f' % np.mean(mAPs))
|
||||||
|
|
Loading…
Reference in New Issue