args = parser.parse_args()# build the model from a config file and a checkpoint filemodel = init_detector(args.config, args.checkpoint, device=args.device)# test a single imageresult =inference_detector(model, args.img)# show the resultsshow_result_pyplot(model, args.img, result, score_t...
saver.restore( sess, model_path )# Fast forward images & save themforidx,imgPinenumerate(imgPath): img = Image.open(imgP) img = img.resize([224,224]) img = np.array(img) img = img.reshape(1,224,224,3) 開發者ID:marc-moreaux,項目名稱:Weakly_detector,代碼行數:32,代碼來源:forward...
device) model = attempt_load(self.weights, map_location=self.device) model.to(self.device).eval() model.half() # torch.save(model, 'test.pt') self.m = model self.names = model.module.names if hasattr( model, 'module') else model.names def preprocess(self, img): img0 = img.copy...
@@ -97,7 +97,7 @@ def load_model(model, pretrained_path, load_to_cpu): # testing begin for i in range(100): image_path = "./curve/sample.jpg" image_path = "./img/sample.jpg" img_raw = cv2.imread(image_path, cv2.IMREAD_COLOR) img = np.float32(img_raw)0...
model.to(self.device).eval() model.half()# torch.save(model, 'test.pt')self.m = model self.names = model.module.namesifhasattr( model,'module')elsemodel.namesdefpreprocess(self, img):img0 = img.copy() img = letterbox(img, new_shape=self.img_size)[0] img = img[:, :, ::-1...