Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/314.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

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/xcode/7.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
Python 类标签输出是指什么?_Python_Detectron - Fatal编程技术网

Python 类标签输出是指什么?

Python 类标签输出是指什么?,python,detectron,Python,Detectron,在detectron2的文档中,说明类标签位于output_dict['Instances'].pred_classes中。这一切都很好,我可以很容易地访问它,但在文档(或输出字典,据我所知)中没有指定哪个整数标签引用哪个类。我假设在某个地方有一本字典,里面有类似于{0:'人',1:'自行车',2:'车',…},但我似乎找不到它。有人知道在哪里可以找到这个吗 以下是输出字典的规范:数据集元数据类有一个属性thing\u classes,其中包含该数据集的类名列表。只需从pred_classes传

detectron2
的文档中,说明类标签位于
output_dict['Instances'].pred_classes
中。这一切都很好,我可以很容易地访问它,但在文档(或输出字典,据我所知)中没有指定哪个整数标签引用哪个类。我假设在某个地方有一本字典,里面有类似于
{0:'人',1:'自行车',2:'车',…}
,但我似乎找不到它。有人知道在哪里可以找到这个吗


以下是输出字典的规范:

数据集元数据类有一个属性
thing\u classes
,其中包含该数据集的类名列表。只需从
pred_classes
传递类id,就可以得到如图所示的类名

pred_classes = output_dict['Instances'].pred_classes.cpu().tolist()
class_names = MetadataCatalog.get("mydataset").thing_classes
pred_class_names = list(map(lambda x: class_names[x], pred_classes))