Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/django/20.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Computer vision 是否可以在RecordIO中使用图像打包边界框和标签?_Computer Vision_Object Detection_Mxnet - Fatal编程技术网

Computer vision 是否可以在RecordIO中使用图像打包边界框和标签?

Computer vision 是否可以在RecordIO中使用图像打包边界框和标签?,computer-vision,object-detection,mxnet,Computer Vision,Object Detection,Mxnet,我正在尝试使用MXNet/Gluon来训练对象检测模型(特别是图像中一种类型对象的多个实例),im2rec工具似乎不会向.rec文件添加边界框信息 mxnet.recordio.pack\u img()似乎可以将图像和标签打包在一起,但我找不到在像素空间中包含边界框信息的位置/方式。从文件中: label = 4 # label can also be a 1-D array, for example: label = [1,2,3] id = 2574 header = mx.recordio

我正在尝试使用MXNet/Gluon来训练对象检测模型(特别是图像中一种类型对象的多个实例),im2rec工具似乎不会向.rec文件添加边界框信息

mxnet.recordio.pack\u img()
似乎可以将图像和标签打包在一起,但我找不到在像素空间中包含边界框信息的位置/方式。从文件中:

label = 4 # label can also be a 1-D array, for example: label = [1,2,3]
id = 2574
header = mx.recordio.IRHeader(0, label, id, 0)
img = cv2.imread('test.jpg')
packed_s = mx.recordio.pack_img(header, img)

标题没有用于边框信息的点。知道怎么做吗?

我相信我已经找到了答案。在.lst文件中打包标签可以获取一组扩展的信息。此处描述了如何期望该信息

然后,剩下的就是编辑,用扩展的信息替换仅仅的标签索引(本文撰写时的第50行和第60行)。比如:

def parse_label_file(fp):
    with open(fp, 'r') as f:
        data = f.readlines() # or json.load() if appropriate
        ### Some code here to parse and return the image dimensions
        ### width, height, id, xmin, ymin, xmax, ymax
    return (4, 5, width, id, height, xmin, ymin, xmax, ymax)

...
label_file_path = path[:-4] + ".txt" # or .json as appropriate
if path not in cat:
    cat[path] = parse_label_file(label_file_path)
...