Artificial intelligence 如何从COCO数据集中筛选类?

Artificial intelligence 如何从COCO数据集中筛选类?,artificial-intelligence,object-detection,yolo,Artificial Intelligence,Object Detection,Yolo,我想用COCO数据集训练一个yolo模型。因为有80多个类,我如何过滤它?我只需要课程“人”和“车”。要获得简单易行的方法,请按照以下步骤操作: 在darknet\data\coco.names中修改或复制coco.names文件以进行备份 删除除个人和汽车以外的所有其他类别 修改您的cfg文件,例如yolov3.cfg,将第610、696、783行的3个类从80更改为2 将第603、689、776行cfg文件中的3个过滤器从255更改为classes+5x3=21 运行检测器。/darknet

我想用COCO数据集训练一个yolo模型。因为有80多个类,我如何过滤它?我只需要课程“人”和“车”。

要获得简单易行的方法,请按照以下步骤操作:

在darknet\data\coco.names中修改或复制coco.names文件以进行备份 删除除个人和汽车以外的所有其他类别 修改您的cfg文件,例如yolov3.cfg,将第610、696、783行的3个类从80更改为2 将第603、689、776行cfg文件中的3个过滤器从255更改为classes+5x3=21 运行检测器。/darknet检测器测试cfg/coco.data cfg/yolov3.cfg yolov3.weights data/person.jpg 要获得更高级的方法,您可以使用此repo创建基于voc、coco或开放图像的YLO数据集

另请参阅:

您可以使用来处理COCO数据集。有了这个库,从数据集中过滤类是如此简单

# Define the classes (out of the 81) which you want to see. Others will not be shown.
filterClasses = ['person', 'dog']

# Fetch class IDs only corresponding to the filterClasses
catIds = coco.getCatIds(catNms=filterClasses) 
# Get all images containing the above Category IDs
imgIds = coco.getImgIds(catIds=catIds)
print("Number of images containing all the  classes:", len(imgIds))

# load and display a random image
img = coco.loadImgs(imgIds[np.random.randint(0,len(imgIds))])[0]
I = io.imread('{}/images/{}/{}'.format(dataDir,dataType,img['file_name']))/255.0

我最近写了一整篇文章。请看一看。

在Coco数据集上过滤类而无需重新训练模型的唯一方法是检查检测输出,以避免为无用类绘制框,但模型将继续检测后台的所有类