diff --git a/yolov3.py b/yolov3.py index b433942..8820aa7 100644 --- a/yolov3.py +++ b/yolov3.py @@ -52,7 +52,7 @@ class WeightReader: for i in range(106): try: conv_layer = model.get_layer('conv_' + str(i)) - print("loading weights of convolution #" + str(i)) + print("Loading weights of convolution #" + str(i)) if i not in [81, 93, 105]: norm_layer = model.get_layer('bnorm_' + str(i)) @@ -76,7 +76,7 @@ class WeightReader: conv_layer.set_weights([kernel]) except ValueError: - print("no convolution #" + str(i)) + print("No convolution #" + str(i)) def reset(self): """ @@ -359,14 +359,16 @@ def _interval_overlap(interval_a, interval_b): if x3 < x1: if x4 < x1: - return 0 + ret = 0 else: - return min(x2,x4) - x1 + ret = min(x2,x4) - x1 else: if x2 < x3: - return 0 + ret = 0 else: - return min(x2,x4) - x3 + ret = min(x2,x4) - x3 + + return ret def bbox_iou(box1, box2): """ @@ -391,9 +393,7 @@ def do_nms(boxes, nms_thresh): for c in range(nb_class): sorted_indices = np.argsort([-box.classes[c] for box in boxes]) - for i in range(len(sorted_indices)): - index_i = sorted_indices[i] - + for i, index_i in enumerate(sorted_indices): if boxes[index_i].classes[c] == 0: continue @@ -455,7 +455,7 @@ def draw_boxes(filename, v_boxes, v_labels, v_scores): # Define the anchors ANCHORS = [[116,90, 156,198, 373,326], [30,61, 62,45, 59,119], [10,13, 16,30, 33,23]] -# Define the probability threshold for detected objects +# Define thLOe probability threshold for detected objects CLASS_THRESHOLD = 0.6 # Define the labels