コード例 #1
0
            - If you do not want to make any prediction in some frames,
              just write "prediction = {}" in the prediction of the frame in the sequence(in line 65 or line 67).
  """

    #評価用の動画データをNo.0〜順番に読み込み
    test_data_path = '../data'
    videos = sorted(glob.glob(test_data_path + '/*.mp4'))

    # 検出したBounding Boxの座標を出力する
    # Output = [name_label, BoxA_X_min, BoxA_X_max, BoxA_Y_min, BoxA_Y_max]
    Output_list = ''
    for i in range(len(videos)):

        video_path = videos[i]
        ScoringService.get_model()
        Output = ScoringService.predict(video_path)
        print(Output)

        if i == 0:  #最初はキーを指定して辞書作成
            Output_list = Output
        else:  #2個目以降はキーを指定して辞書追加
            Output_list.update(Output)

        print("**************************")

        # Output douga mp4
        #ScoringService.get_model()
        #ScoringService.pw_outdouga(video_path)

    with open('../output/prediction.json', 'w') as f:
        json.dump(Output_list, f)
コード例 #2
0
from predictor import ScoringService as ss

if __name__ == '__main__':
    print('Model Load:', ss.get_model())
    print(ss.predict(ss.get_inputs(), '2020-12-30'))
    
コード例 #3
0
ファイル: main.py プロジェクト: stjordanis/EdgeAIContest3
exp_name = "flip_lr.aspect."

if ScoringService.get_model():
    start_time = time.time()
    target_videos = [
        "train_00", "train_01", "train_02", "train_12", "train_16", "train_22"
    ]
    # target_videos = ["train_{:02d}".format(i) for i in range(0,25)]

    combined_prediction_json = {}
    print("Processing videos = {}".format(target_videos))
    for train_file in target_videos:
        start_time_train = time.time()
        print("Train_file = {}".format(train_file))
        preds_json = ScoringService.predict(
            "/ext/signate_edge_ai/train_videos/{}.mp4".format(train_file))
        with open(exp_name + '{}.preds.json'.format(train_file),
                  'w+') as output_json_file:
            json.dump(preds_json, output_json_file)

        key = "{}.mp4".format(train_file)
        combined_prediction_json[key] = preds_json[key]
        end_time_train = time.time()
        print("[PERFORMANCE] ScoringService Video {} Total_Time = {}".format(
            train_file, end_time_train - start_time_train))
        print("-----------------------------")

    print("Outputing combined predictions ")
    with open(exp_name + 'prediction.json', 'w+') as output_combined_json_file:
        json.dump(combined_prediction_json, output_combined_json_file)
    end_time = time.time()