Skip to content

Commit

Permalink
updates
Browse files Browse the repository at this point in the history
  • Loading branch information
glenn-jocher committed Sep 8, 2018
1 parent af9864d commit a284fc9
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 5 deletions.
2 changes: 1 addition & 1 deletion detect.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ def detect(opt):
# Add the bbox to the plot
label = '%s %.2f' % (classes[int(cls_pred)], conf)
color = bbox_colors[int(np.where(unique_classes == int(cls_pred))[0])]
plot_one_box([x1, y1, x2, y2], img, label=label, color=color, line_thickness=3)
plot_one_box([x1, y1, x2, y2], img, label=label, color=color)

if opt.plot_flag:
# Save generated image with detections
Expand Down
5 changes: 4 additions & 1 deletion test.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
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('-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.weights', help='path to weights file')
parser.add_argument('-weights_path', type=str, default='checkpoints/yolov3.pt', 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('-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')
Expand Down Expand Up @@ -63,6 +63,9 @@
output = model(imgs)
output = non_max_suppression(output, conf_thres=opt.conf_thres, nms_thres=opt.nms_thres)

# import matplotlib.pyplot as plt
# plt.imshow(imgs[1][0])

# Compute average precision for each sample
for sample_i in range(len(targets)):
correct = []
Expand Down
3 changes: 1 addition & 2 deletions utils/datasets.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,7 @@ def __init__(self, path, batch_size=1, img_size=608, augment=False):

def __iter__(self):
self.count = -1
self.shuffled_vector = np.random.permutation(self.nF) # shuffled vector
# self.shuffled_vector = np.arange(self.nF) # not shuffled
self.shuffled_vector = np.random.permutation(self.nF) if self.augment else np.arange(self.nF)
return self

def __next__(self):
Expand Down
2 changes: 1 addition & 1 deletion utils/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ def xview_class_weights(indices): # weights of each class in the training set,


def plot_one_box(x, img, color=None, label=None, line_thickness=None): # Plots one bounding box on image img
tl = line_thickness or round(0.003 * max(img.shape[0:2])) # line thickness
tl = line_thickness or round(0.002 * max(img.shape[0:2])) + 1 # line thickness
color = color or [random.randint(0, 255) for _ in range(3)]
c1, c2 = (int(x[0]), int(x[1])), (int(x[2]), int(x[3]))
cv2.rectangle(img, c1, c2, color, thickness=tl)
Expand Down

0 comments on commit a284fc9

Please sign in to comment.