Example #1
0
        exit(1)
    if args.nms < 0 or args.nms >= 1:
        eprint("the nms must be within [0, 1[")
        exit(1)
    if args.mask_threshold < 0 or args.mask_threshold >= 1:
        eprint("the mask_threshold must be within [0, 1[")
        exit(1)
    if args.input_size < 224 or args.input_size > 720:
        eprint("As input image is 960*720 and 224 is quite small, input size must be within [224, 720]")
        exit(1)

    if args.model == "None":
        frame_processor = FrameProcessor()
    elif args.model.startswith("yolo") or args.model.startswith("ssd"):
        frame_processor = ObjectDetector(args.model, args.input_size, args.threshold, args.nms, args.use_gpu)
    elif args.model == "posenet":
        frame_processor = PoseDetector(args.model, args.threshold)
    elif args.model == "maskrcnn":
        frame_processor = ObjectSegmentor(args.input_size, args.threshold, args.mask_threshold, args.use_gpu)
    elif args.model == "midas":
        if args.input_size % 32 != 0:
            eprint("Input size must be a multiple of 32 for Midas")
            exit(1)
        frame_processor = DepthEstimator(args.input_size, args.use_gpu)
    else:
        raise ValueError("Not implemented")

    frontend = FrontEnd(args.drone_speed, args.azerty and os.name != "nt", frame_processor)  # azerty keyboard
    # automatically handled on windows
    frontend.run()