if cv2.waitKey(1) & 0xFF == ord('q'): break camera.release() cv2.destroyAllWindows() if __name__ == "__main__": from models.ssd import SSD300 from utils.boxes import create_prior_boxes from utils.boxes import to_point_form dataset_name = 'VOC2007' # weights_path = '../trained_models/SSD300_weights.hdf5' # weights_path = '../trained_models/weights.07-3.59.hdf5' # weights_path = '../trained_models/weights.03-3.37.hdf5' # weights_path = '../trained_models/weights.150-3.57.hdf5' # weights_path = '../trained_models/weights.12-4.20.hdf5' # weights_path = '../trained_models/weights.02-3.44.hdf5' # weights_path = '../trained_models/weights.22-5.01.hdf5' # weights_path = '../trained_models/weights.79-6.66.hdf5' # weights_path = '../trained_models/weights.64-6.52.hdf5' # weights_path = '../trained_models/weights.22-3.85.hdf5' # weights_path = '../trained_models/weights.50-3.92.hdf5' weights_path = '../trained_models/weights.04-3.79.hdf5' model = SSD300(weights_path=weights_path) prior_boxes = to_point_form(create_prior_boxes()) # prior_boxes = to_point_form(prior_boxes) video = VideoDemo(prior_boxes, dataset_name) video.start_video(model)
class_names = dataset_manager.class_names print('Found:', len(ground_truth_data), 'images') print('Class names: \n', class_names) # prior boxes # ------------------------------------------------------------------ # model = SSD300() prior_boxes = create_prior_boxes() print('Prior boxes shape:', prior_boxes.shape) print('Prior box example:', prior_boxes[777]) image_path = '../images/fish-bike.jpg' # input_shape = model.input_shape[1:3] input_shape = (300, 300) image_array = load_image(image_path, input_shape) prior_boxes = to_point_form(prior_boxes) box_coordinates = prior_boxes[7010:7015, :] plot_box_data(box_coordinates, image_array) plt.imshow(image_array) plt.show() # ground truth # ------------------------------------------------------------------ image_name, box_data = random.sample(ground_truth_data.items(), 1)[0] print('Data sample: \n', box_data) # image_path = dataset_manager.images_path + image_name image_path = image_name arg_to_class = dataset_manager.arg_to_class colors = get_colors(len(class_names)) image_array = load_image(image_path, input_shape) plot_box_data(box_data, image_array, arg_to_class, colors=colors)