super(Ui_MainWindow, self).__init__(parent) parser_car_det = argparse.ArgumentParser() # parser.add_argument('--weights', type=str, default='weights-s/best1.pt', help='model.pt path') parser_car_det.add_argument('--weights', type=str, default='weights-s/best1.pt', help='model.pt path') parser_car_det.add_argument('--source', type=str, default='input/3.mp4', help='source') # file/folder, 0 for webcam # parser.add_argument('--source', type=str, default='rtsp://admin:hik12345@192.168.1.64:554//Streaming/Channels/101', help='source') # file/folder, 0 for webcam parser_car_det.add_argument('--output', type=str, default='inference/output', help='output folder') # output folder parser_car_det.add_argument('--img-size', type=int, default=640, help='inference size (pixels)') parser_car_det.add_argument('--conf-thres', type=float, default=0.4, help='object confidence threshold') parser_car_det.add_argument('--iou-thres', type=float, default=0.5, help='IOU threshold for NMS') parser_car_det.add_argument('--fourcc', type=str, default='mp4v', help='output video codec (verify ffmpeg support)') parser_car_det.add_argument('--device', default='cpu', help='cuda device, i.e. 0 or 0,1,2,3 or cpu') parser_car_det.add_argument('--view-img', action='store_true', help='display results') parser_car_det.add_argument('--save-txt', action='store_true', help='save results to *.txt') parser_car_det.add_argument('--classes', nargs='+', type=int, help='filter by class') parser_car_det.add_argument('--agnostic-nms', action='store_true', help='class-agnostic NMS') parser_car_det.add_argument('--augment', action='store_true', help='augmented inference') parser_car_det.add_argument('--idx', default='2', help='idx') self.opt_car_det = parser_car_det.parse_args() self.opt_car_det.img_size = check_img_size(self.opt_car_det.img_size) half = 0 source_car_det, weights_car_det, view_img_car_det, save_txt_car_det, imgsz_car_det = self.opt_car_det.source, self.opt_car_det.weights, self.opt_car_det.view_img, self.opt_car_det.save_txt, self.opt_car_det.img_size self.device_car_det = torch_utils.select_device(self.opt_car_det.device) self.half_car_det = 0 # half precision only supported on CUDA cudnn.benchmark = True
时间: 2023-06-02 14:06:02 浏览: 218
Chapter-2-layout-management.rar_qt mainwindow
super(Ui_MainWindow, self).__init__(parent) 表示使用父类的构造函数来初始化子类,这里父类是 Ui_MainWindow。
parser_car_det = argparse.ArgumentParser() 表示定义了一个解析器,用来解析输入的参数。
阅读全文