netC = MonoPortNet(cfg.netC) netC.load_legacy_pifu(cfg.netC.ckpt_path) netC.image_filter = netC.image_filter.to(cuda_backbone_C) netC.surface_classifier = netC.surface_classifier.to(cuda_color) netC.eval() else: netC = None print("we are not loading netC ...") ######################################## ## initialize data streamer ######################################## print("initialize data streamer ...") if args.camera: data_stream = streamer.CaptureStreamer(pad=False) elif len(args.videos) > 0: data_stream = streamer.VideoListStreamer(args.videos) elif len(args.images) > 0: data_stream = streamer.ImageListStreamer(args.images) elif args.image_folder is not None: images = sorted(glob.glob(args.image_folder + "/*.jpg")) images += sorted(glob.glob(args.image_folder + "/*.png")) data_stream = streamer.ImageListStreamer(images) ######################################## ## human segmentation model ######################################## seg_engine = human_inst_seg.Segmentation(device=cuda_backbone_G, verbose=False) seg_engine.eval()
bbox = bboxes[0, 0, 0].cpu().numpy() window = cv2.rectangle(window, (int(bbox[0]), int(bbox[1])), (int(bbox[2]), int(bbox[3])), (255, 0, 0), 2) window = cv2.cvtColor(window, cv2.COLOR_BGR2RGB) window = cv2.resize(window, (0, 0), fx=2, fy=2) cv2.imshow('window', window) cv2.waitKey(30) seg_engine = human_inst_seg.Segmentation() seg_engine.eval() if args.camera: data_stream = streamer.CaptureStreamer() elif len(args.videos) > 0: data_stream = streamer.VideoListStreamer(args.videos * (10000 if args.loop else 1)) elif len(args.images) > 0: data_stream = streamer.ImageListStreamer(args.images * (10000 if args.loop else 1)) loader = torch.utils.data.DataLoader( data_stream, batch_size=1, num_workers=1, pin_memory=False, ) try: