示例#1
0
                study_name = get_file_name(environment.current_study.study_dir)
            path_len = environment.current_study.image_index - warm_frames_num
            print("{}:\t len {},\t done: {}".format(study_name, path_len, environment.current_study.finished_successfully))

        environment.write_stats()


if __name__ == '__main__':
    # if len(sys.argv) == 1:
    #     print("Error: missing run mode type (hand/fingers)")
    #     sys.exit(1)
    #
    # run_mode_type = sys.argv[1]
    # set_run_config(run_mode_type)

    sys.stdout = StdoutLog(log_dir, sys.stdout, print_to_log, print_to_stdout)
    create_dir(checkpoint_dir)

    if mode == "train":
        if platform.system() == 'Linux':
            if mode_type == "hand":
                print("use hands dataset..")
                train(["/home/ami/handsTrack/studies/full_hands/17.12.17",
                       "/home/ami/handsTrack/studies/full_hands/18.12.17",
                       "/home/ami/handsTrack/studies/full_hands/19.12.17"],
                      list_of_dirs=True)
            else:
                print("use fingers dataset..")
                train("/home/ami/handsTrack/studies/fingers/20.12.17")

        else:
                image, point = study.next()
                point = [point.x, point.y]
                loss, next_state, p, check = sess.run([tracker.loss, tracker.out_state, tracker.predict, tracker.check],
                                         feed_dict={tracker.input_frames: image,
                                                    tracker.target: [point],
                                                    tracker.keep_prob: keep_prob,
                                                    tracker.cell_state: current_cell_state,
                                                    tracker.hidden_state: current_hidden_state})
                current_cell_state, current_hidden_state = next_state

                # print("predict: {}, relative: {}, loss = {}".format(np.array(p), point, loss))
                # print(np.mean(current_cell_state - old_state))
                # old_state = current_cell_state

if __name__ == '__main__':
    sys.stdout = StdoutLog(log_file, sys.stdout, print_to_log, print_to_stdout)

    if mode == "train":
        print("Start training ..")
        if platform.system() == 'Linux':
            train("/home/ami/fingersTracking/data/try")  
            #train(["/home/ami/fingersTracking/data/studies",
            #      "/home/ami/fingersTracking/data/studies9.1.18"], list_of_dirs=True)
        else:
            train("C:/Users/il115552/Desktop/New folder (6)")

    if mode == "test":
        print("Start testing ..")
        if platform.system() == 'Linux':
            test("/home/ami/fingersTracking/data/test")
        else: