def load_models(): models = [] nb_models = 5 for run in range(nb_models): print("====== Loading ensemble model: %d ======" % run) m = BaseModel('data/', dense_nodes=4096) model_prefix = "da_r%d_" % run m.model_name = model_prefix + m.model_name print("model path: %s" % m.model_path) m.load_model() models = models + [m] return models
def test_and_submit(): print("====== loading model ======") m = BaseModel('data/') m.load_model() print("====== running test ======") preds, test_batches = m.test() print("======= making submission ========") submits_path = 'submits/base_model_subm.gz' submit(preds, test_batches, submits_path) print("======= pushing to kaggle ========") push_to_kaggle(submits_path)
ap.add_argument("-i", "--input", required=True, type=str, help="Path to image or video file") ap.add_argument("-d", "--device", type=str, default="CPU", help="Specify the target device to infer on") ap.add_argument("-o", "--output", type=str, default="output", help="output file for storing stats") ap.add_argument("-pt", "--threshold", type=float, default=0.5, help="Probability threshold for detections filtering") ap.add_argument("-fdv", "--fdv", type=str, help="FaceDetection visualization") ap.add_argument("-lmv", "--lmv", type=str, help="LandmarksDetection visualization") ap.add_argument("-hpv", "--hpv", type=str, help="HeadPoseEstimation visualization") args = vars(ap.parse_args()) pyautogui.FAILSAFE = False mltime_s = time.time() #importing models net1 = BaseModel(args['model1']) m1time_s = time.time() fd_shape, fd_name = net1.load_model() face_load_time= time.time() - m1time_s print('FaceDetection Model Load Time: {}'.format(face_load_time)) net2 = BaseModel(args['model2']) m2time_s = time.time() lm_shape, lm_name = net2.load_model() land_load_time= time.time() - m2time_s print('LandmarksDetection Model Load Time: {}'.format(land_load_time)) net3 = BaseModel(args['model3']) m3time_s = time.time() hp_shape, hp_name = net3.load_model() head_load_time= time.time() - m3time_s print('HeadPoseEstimation Model Load Time: {}'.format(head_load_time))