Demo entry 6742596



Submitted by anonymous on May 18, 2018 at 09:56
Language: Python. Code size: 1.2 kB.

# メイン関数
if __name__ == '__main__':          
    # -----------------------------------------------------------
    # 引数処理
    # -----------------------------------------------------------
    ap = argparse.ArgumentParser()
    ap.add_argument('-l', '--label', type=str, default=InputLabel,
                    help='path to the label file')
    ap.add_argument('-d', '--data', type=str, default=DataFile,
                    help='path to the dataset (.npy)')
    ap.add_argument('-i', '--img', type=str, required=True,
                    help='path to the input image')
    ap.add_argument('-m', '--model', type=str, default=ModelFile,
                    help='path to the pre-trained network to use (.h5)')
    ap.add_argument('-s', '--image_size', type=int, default=ImageSize,
                    help='image size')
    args = vars(ap.parse_args())

    if not os.path.exists(args['label']):
        print "Error: No such directory [%s] " % (args['label'])

    # ラベルの読み込み
    label_info = None
    if os.path.exists(args['label']):
        with open(args['label'], 'r') as f:        
            label_info = json.load(f)

This snippet took 0.01 seconds to highlight.

Back to the Entry List or Home.

Delete this entry (admin only).