我正在使用东部文本检测模型,并使用它来检测某些品牌标签中的文本(为此进行了培训)。我正在打印编号。模型返回的盒数,首先显示(返回的盒数= 13),但是当我循环并在图像上绘制边框时,没有。返回的包装盒数已更改(返回的包装盒数= 9)。我没有得到如何。当我尝试将其绘制到图像本身上时,模型返回的盒子数量会发生变化。
boxes = detection_text_single_image(image, settings.DOCKER_PORTS[0])
print("------------------boxes returned by the east model")
print(boxes)
print("*"*70)
print(len(boxes))
print("*"*70)
## ones we get the boxes using the east model we will draw those rectangle over the brand tag image
##sort_poly is used to sort the each box's point clockwise
##then after sorting we will take the top left and bottom right point of each box and draw the rectangles using for loop
image1 = image.copy()
if boxes is not None:
for box in boxes:
print("box no. inside the boxes")
print(box)
box = sort_poly(box.astype(np.int32))
cv2.rectangle(image1, (box[0][0],box[0][1]), (box[2][0],box[2][1]), (255,0,0), 2)
#cv2.imshow("image1", image1)
#cv2.waitKey(0)
#cv2.destroyAllWindows()
2。当我不评论显示图像的那部分(代码的最后几行)时,返回的盒子数是9。
boxes = detection_text_single_image(image, settings.DOCKER_PORTS[0])
print("------------------boxes returned by the east model")
print(boxes)
print("*"*70)
print(len(boxes))
print("*"*70)
## ones we get the boxes using the east model we will draw those rectangle over the brand tag image
##sort_poly is used to sort the each box's point clockwise
##then after sorting we will take the top left and bottom right point of each box and draw the rectangles using for loop
image1 = image.copy()
if boxes is not None:
for box in boxes:
print("box no. inside the boxes")
print(box)
box = sort_poly(box.astype(np.int32))
cv2.rectangle(image1, (box[0][0],box[0][1]), (box[2][0],box[2][1]), (255,0,0), 2)
cv2.imshow("image1", image1)
cv2.waitKey(0)
cv2.destroyAllWindows()
我认为在两种情况下,它应该返回相同的编号。的盒子