示例#1
0
def save_ocoloenv_images(retina, random_rate, retry, datasets, dirname, suffix):
    for content_id, content in enumerate(make_contents(), 1):
        sys.stderr.write('generating images (content_id == {})...'.format(content_id))
        sys.stderr.flush()
        env = Environment(content, on_buffer_width=128, retina=retina)
        for datatype, n in datasets:
            prefix = '{}/{}/{}/'.format(dirname, datatype, content_id)
            subprocess.call(['mkdir', '-p', prefix])
            for i in range(n):
                filename = '{}{}{}'.format(prefix, i, suffix)
                save_screen_images(env, random_rate, retry, filename)
        env.close()
        sys.stderr.write('done\n')
示例#2
0
        help="Flag to debug execute step by step with one key press",
        type=bool,
        default=False)

    args = parser.parse_args()

    if args.content == Contents.POINT_TO_TARGET:
        content = PointToTargetContent()
    elif args.content == Contents.CHANGE_DETECTION:
        content = ChangeDetectionContent()
    elif args.content == Contents.ODD_ONE_OUT:
        content = OddOneOutContent()
    elif args.content == Contents.VISUAL_SEARCH:
        content = VisualSearchContent()
    elif args.content == Contents.MULTIPLE_OBJECT_TRACKING:
        content = MultipleObjectTrackingContent()
    elif args.content == Contents.RANDOM_DOT_MOTION_DISCRIMINATION:
        content = RandomDotMotionDiscriminationContent()
    else:
        print("Unknown argument")
        sys.exit(1)

    env = Environment(content)
    env.render()  # env.window is created here

    handler = KeyHandler(env, args.step_debug)

    pyglet.app.run()

    env.close()