简体   繁体   English

如何从训练和测试图像创建 Yolo model?

[英]How to create Yolo model from train and test images?

I have a dataset of images that have two folders: test and training.我有一个包含两个文件夹的图像数据集:测试和训练。 I need to do object detection using OpenCV and Yolo.我需要使用 OpenCV 和 Yolo 进行 object 检测。

Thus, I need to create my own Yolo model for the street objects.因此,我需要为街道对象创建自己的 Yolo model。

For the training folder: training对于培训文件夹:培训

Example training image: training image训练图像示例:训练图像

For the test folder: test对于测试文件夹: test

I have the classes txt file which includes id, name and classification (warning, indication and mandatory).我有类 txt 文件,其中包括 id、名称和分类(警告、指示和强制)。 Example:例子:

0 = animal crossing (warning)
1 = soft verges (warning)
2 = road narrows (warning)

Here, the numbers are the numbers (or ids) in the training folder, names, and classification.在这里,数字是训练文件夹中的数字(或 ID)、名称和分类。

My purpose is to create a Yolo model from these training images.我的目的是从这些训练图像中创建一个 Yolo model。 I have checked some papers and articles, but in their case, they label the full image using labelimg, but in my case training images are so small and they don't need any labeling.我检查了一些论文和文章,但在他们的情况下,他们使用 labelimg 的完整图像 label,但在我的情况下,训练图像非常小,不需要任何标记。

Thus, I'm confused about how to do this.因此,我对如何做到这一点感到困惑。 Could you please give me some ideas?你能给我一些想法吗?

I would refer to this image that describes the different types of computer vision tasks.我会参考这张描述不同类型的计算机视觉任务的图像。

计算机视觉任务

I think what you want to do is a Classification tasks.我想你想做的是一个分类任务。 Yolo is for Object Detection tasks, where you usually want to detect more than one object per image. Yolo 用于 Object 检测任务,您通常希望在每个图像中检测多个 object。

For classification tasks, it can be easier because you don't need to make separate label files.对于分类任务,它可能更容易,因为您不需要制作单独的 label 文件。 The names of the folders are the labels.文件夹的名称是标签。 Here is an example of a classification model that you can use https://pytorch.org/tutorials/beginner/transfer_learning_tutorial.html这是分类 model 的示例,您可以使用https://pytorch.org/tutorials/beginner/transfer_learning_tutorial.ZFC35FDC70D5FC69D269883A822C7A53

If you really want to use Yolo you will need to make label files.如果你真的想使用 Yolo,你需要制作 label 文件。 If you are going to do Classification of the whole image then the format of the annotation will be easy.如果您要对整个图像进行分类,那么注释的格式将很容易。 It would be something like this.会是这样的。

`0 0.5 0.5 1 1' The first column is the class number: 0,1,2,3 etc. You will need to make one file for each image with the name.txt. `0 0.5 0.5 1 1' 第一列是 class 编号:0,1,2,3 等。您需要为每个图像创建一个名为.txt 的文件。

Does this help you?这对你有帮助吗?

Labeling images is a must in YOLO's that's how they deal with their loss functions.在 YOLO 中标记图像是必须的,这就是他们处理损失函数的方式。 To detect objects something called (intersection over union ) More easy way to label images is by using (roboflow site ).要检测称为(联合上的交集)的对象,label 图像的更简单方法是使用(roboflow 站点)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM