) parser.add_argument( "--epochs", type=float, default=40, help = "Number of epochs for training last layers and number of epochs for fine-tuning layers. Default is 51." ) FLAGS = parser.parse_args() np.random.seed(FLAGS.random_seed) log_dir = FLAGS.log_dir class_names = get_classes(FLAGS.classes_file) num_classes = len(class_names) anchors = get_anchors(FLAGS.anchors_path) weights_path = FLAGS.weights_path input_shape = (416, 416) # multiple of 32, height, width epoch1, epoch2 = FLAGS.epochs, FLAGS.epochs is_tiny_version = (len(anchors)==6) # default setting if FLAGS.is_tiny: model = create_tiny_model(input_shape, anchors, num_classes, freeze_body=2, weights_path = weights_path) else: model = create_model(input_shape, anchors, num_classes, freeze_body=2, weights_path = weights_path) # make sure you know what you freeze log_dir_time = os.path.join(log_dir,'{}'.format(int(time()))) logging = TensorBoard(log_dir=log_dir_time)
) parser.add_argument( "--video_out", type=str, dest="out_path", default='./vidout/out.avi', help="Path to the videos", ) FLAGS = parser.parse_args() # Split images and videos img_endings = (".jpg", ".jpeg", ".png") vid_endings = (".mp4", ".mpeg", ".mpg", ".avi") anchors = get_anchors(anchors_path) yolo = YOLO( **{ "model_path": FLAGS.model_path, "anchors_path": anchors_path, "classes_path": FLAGS.classes_path, "score": FLAGS.score, "gpu_num": FLAGS.gpu_num, "model_image_size": (416, 416), }) # labels to draw on images class_file = open(FLAGS.classes_path, "r") input_labels = [line.rstrip("\n") for line in class_file.readlines()] FLAGS.output = 'vidout'