未验证 提交 20bd5095 编写于 作者: J JiaQi Xu 提交者: GitHub

Update get_dr_txt.py

上级 3b0eb1f6
...@@ -17,11 +17,12 @@ class mAP_SSD(SSD): ...@@ -17,11 +17,12 @@ class mAP_SSD(SSD):
crop_img = np.array(letterbox_image(image, (self.model_image_size[0],self.model_image_size[1]))) crop_img = np.array(letterbox_image(image, (self.model_image_size[0],self.model_image_size[1])))
photo = np.array(crop_img,dtype = np.float64) photo = np.array(crop_img,dtype = np.float64)
# 图片预处理,归一化 # 图片预处理,归一化
photo = Variable(torch.from_numpy(np.expand_dims(np.transpose(crop_img-MEANS,(2,0,1)),0)).cuda().type(torch.FloatTensor)) with torch.no_grad():
preds = self.net(photo) photo = Variable(torch.from_numpy(np.expand_dims(np.transpose(crop_img-MEANS,(2,0,1)),0)).type(torch.FloatTensor))
if self.cuda:
photo = photo.cuda()
preds = self.net(photo)
top_conf = [] top_conf = []
top_label = [] top_label = []
top_bboxes = [] top_bboxes = []
...@@ -77,4 +78,4 @@ for image_id in image_ids: ...@@ -77,4 +78,4 @@ for image_id in image_ids:
print(image_id," done!") print(image_id," done!")
print("Conversion completed!") print("Conversion completed!")
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册