Keras_ocr - 未能 recognize_from_boxes
Keras_ocr - Failed to recognize_from_boxes
我正在使用 keras_ocr 识别器,我希望它只扫描我已经选择的边界框内。 API 支持 recognize_from_boxes
的这种操作 只是让你知道: keras_ocr documentation.
#Parameters
#images – A list of input images, supplied as numpy arrays with shape (H, W, 3).
#boxes – A list of groups of boxes, one for each image
#Recognizer_ = Recognizer_.recognize_from_boxes(images = img_list, box_groups= bb_list)
我向函数发送两个参数,第一个是作为 numpy 数组的图像列表:
其次,我发送边界框列表:
我遇到的问题是类型错误,TypeError: object of type 'int' has in len()
,指出输入的类型无效。我想更多地了解错误和可能的解决方案。与错误调用相关的打印:
在 API 文档中它提到 box_groups
应该是 A list of groups of boxes, one for each image
这意味着它假设单个图像中可能有很多框,但您的输入只是 a list on boxes
.如果每张图片只有一个盒子,那么你可以这样做 -
# reshape bb_list from (N, 4) -> (N, 1, 4)
Recognizer_ = Recognizer_.recognize_from_boxes(images = img_list,
box_groups= np.expand_dims(bb_list, axis=1))
我正在使用 keras_ocr 识别器,我希望它只扫描我已经选择的边界框内。 API 支持 recognize_from_boxes
的这种操作 只是让你知道: keras_ocr documentation.
#Parameters
#images – A list of input images, supplied as numpy arrays with shape (H, W, 3).
#boxes – A list of groups of boxes, one for each image
#Recognizer_ = Recognizer_.recognize_from_boxes(images = img_list, box_groups= bb_list)
我向函数发送两个参数,第一个是作为 numpy 数组的图像列表:
其次,我发送边界框列表:
我遇到的问题是类型错误,TypeError: object of type 'int' has in len()
,指出输入的类型无效。我想更多地了解错误和可能的解决方案。与错误调用相关的打印:
在 API 文档中它提到 box_groups
应该是 A list of groups of boxes, one for each image
这意味着它假设单个图像中可能有很多框,但您的输入只是 a list on boxes
.如果每张图片只有一个盒子,那么你可以这样做 -
# reshape bb_list from (N, 4) -> (N, 1, 4)
Recognizer_ = Recognizer_.recognize_from_boxes(images = img_list,
box_groups= np.expand_dims(bb_list, axis=1))