Beispiel #1
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'))
    
Beispiel #2
0
              Do not include other categories in the prediction you will make.
            - 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:
Beispiel #3
0
#  The video file on which we want to perform inference (object detection and tracking) is passed as file path parameter to the predict function.
#  The results are returned in json format consisting of class predictions and assigned ids for each frame.
#  Multiple videos are passed by looping over the predict function and the results are aggregated into one json file.
#  Released under Apache License 2.0
#  Email: [email protected]
# -----------------------------------------------------------
import os
os.environ["CUDA_VISIBLE_DEVICES"] = "0"
import pdb
import json
import time
from predictor import ScoringService

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:
Beispiel #4
0
from predictor import ScoringService as cls

# データセットをダウンロードして解凍したファイルを配置した場所を定義します。
# データ保存先ディレクトリ
DATASET_DIR= "../../data_dir"

# 読み込むファイルを定義します。
inputs = cls.get_inputs(DATASET_DIR)

print(inputs)
cls.train_and_save_model(inputs, model_path="model")
Beispiel #5
0
            - The categories for testing are "Car" and "Pedestrian".
              Do not include other categories in the prediction you will make.
            - 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).
  """

  data_path = '../data'#読みこむデータのパスを記載

  #複数のファイルに対応済み
  videos = glob.glob(data_path+'/*.mp4')
  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: