김성주

fixed video test code

...@@ -16,7 +16,7 @@ def readImage(path): ...@@ -16,7 +16,7 @@ def readImage(path):
16 16
17 def main(): 17 def main():
18 ANNOTATION_PATH = '../data/train.txt' #annotation set (train/val/test) text file 18 ANNOTATION_PATH = '../data/train.txt' #annotation set (train/val/test) text file
19 - IMAGE_DIRECTORY = 'image_data/' #image directory 19 + IMAGE_DIRECTORY = 'image_data' #image directory
20 SAVE_PATH = 'train.tfrecord' #save path for tfrecord 20 SAVE_PATH = 'train.tfrecord' #save path for tfrecord
21 21
22 print('Tensorflow version:', tf.__version__) #tensorflow version should be 1.x 22 print('Tensorflow version:', tf.__version__) #tensorflow version should be 1.x
......
...@@ -12,8 +12,9 @@ img_size = 416 ...@@ -12,8 +12,9 @@ img_size = 416
12 weight_path = '../../data/darknet_weights/yolov3.weights' 12 weight_path = '../../data/darknet_weights/yolov3.weights'
13 save_path = '../../data/darknet_weights/yolov3.ckpt' 13 save_path = '../../data/darknet_weights/yolov3.ckpt'
14 anchors = parse_anchors('../../data/yolo_anchors.txt') 14 anchors = parse_anchors('../../data/yolo_anchors.txt')
15 +class_num = 1
15 16
16 -model = yolov3(80, anchors) 17 +model = yolov3(class_num, anchors)
17 with tf.Session() as sess: 18 with tf.Session() as sess:
18 inputs = tf.placeholder(tf.float32, [1, img_size, img_size, 3]) 19 inputs = tf.placeholder(tf.float32, [1, img_size, img_size, 3])
19 20
......
...@@ -14,19 +14,19 @@ from data_utils import letterbox_resize ...@@ -14,19 +14,19 @@ from data_utils import letterbox_resize
14 from model import yolov3 14 from model import yolov3
15 15
16 parser = argparse.ArgumentParser(description="YOLO-V3 video test procedure.") 16 parser = argparse.ArgumentParser(description="YOLO-V3 video test procedure.")
17 -parser.add_argument("input_video", type=str, 17 +parser.add_argument("--input_video", type=str, default="../../data/video.mp4",
18 help="The path of the input video.") 18 help="The path of the input video.")
19 -parser.add_argument("--anchor_path", type=str, default="./data/yolo_anchors.txt", 19 +parser.add_argument("--anchor_path", type=str, default="../../data/yolo_anchors.txt",
20 help="The path of the anchor txt file.") 20 help="The path of the anchor txt file.")
21 parser.add_argument("--new_size", nargs='*', type=int, default=[416, 416], 21 parser.add_argument("--new_size", nargs='*', type=int, default=[416, 416],
22 help="Resize the input image with `new_size`, size format: [width, height]") 22 help="Resize the input image with `new_size`, size format: [width, height]")
23 parser.add_argument("--letterbox_resize", type=lambda x: (str(x).lower() == 'true'), default=True, 23 parser.add_argument("--letterbox_resize", type=lambda x: (str(x).lower() == 'true'), default=True,
24 help="Whether to use the letterbox resize.") 24 help="Whether to use the letterbox resize.")
25 -parser.add_argument("--class_name_path", type=str, default="./data/classes.txt", 25 +parser.add_argument("--class_name_path", type=str, default="../../data/classes.txt",
26 help="The path of the class names.") 26 help="The path of the class names.")
27 -parser.add_argument("--restore_path", type=str, default="./data/darknet_weights/yolov3.ckpt", 27 +parser.add_argument("--restore_path", type=str, default="../data/trained/model.ckpt",
28 help="The path of the weights to restore.") 28 help="The path of the weights to restore.")
29 -parser.add_argument("--save_video", type=lambda x: (str(x).lower() == 'true'), default=False, 29 +parser.add_argument("--save_video", type=lambda x: (str(x).lower() == 'true'), default=True,
30 help="Whether to save the video detection results.") 30 help="Whether to save the video detection results.")
31 args = parser.parse_args() 31 args = parser.parse_args()
32 32
......
...@@ -1672,7 +1672,8 @@ ...@@ -1672,7 +1672,8 @@
1672 " save_path = '/content/gdrive/My Drive/yolo/weights/yolov3.ckpt'\n", 1672 " save_path = '/content/gdrive/My Drive/yolo/weights/yolov3.ckpt'\n",
1673 " anchors = parse_anchors('/content/gdrive/My Drive/yolo/data/yolo_anchors.txt')\n", 1673 " anchors = parse_anchors('/content/gdrive/My Drive/yolo/data/yolo_anchors.txt')\n",
1674 "\n", 1674 "\n",
1675 - " model = yolov3(80, anchors)\n", 1675 + " class_num = 1\n"
1676 + " model = yolov3(class_num, anchors)\n",
1676 " with tf.Session() as sess:\n", 1677 " with tf.Session() as sess:\n",
1677 " inputs = tf.placeholder(tf.float32, [1, img_size, img_size, 3])\n", 1678 " inputs = tf.placeholder(tf.float32, [1, img_size, img_size, 3])\n",
1678 "\n", 1679 "\n",
......