没有。当我在图像上绘制边界时,东部文本检测模型返回的边界框会发生变化

时间:2019-07-25 10:35:40

标签: python opencv deep-learning computer-vision

我正在使用东部文本检测模型,并使用它来检测某些品牌标签中的文本(为此进行了培训)。我正在打印编号。模型返回的盒数,首先显示(返回的盒数= 13),但是当我循环并在图像上绘制边框时,没有。返回的包装盒数已更改(返回的包装盒数= 9)。我没有得到如何。当我尝试将其绘制到图像本身上时,模型返回的盒子数量会发生变化。

  1. 不。返回的框数是13(当我评论基本上显示图像的最后几行代码时)
    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()

我认为在两种情况下,它应该返回相同的编号。的盒子

0 个答案:

没有答案