如何放置训练Yolov5的数据集?

发布于 2025-01-16 22:58:10 字数 687 浏览 6 评论 0原文

我目前正在使用 yolov5 进行物体检测。我使用自定义数据集训练了一个模型,该数据集有 3 个类= ['汽车','摩托车','人']

我有很多与 yolov5 相关的问题。

我的数据集包含

所有自定义图像均使用 Roboflow 进行标记。

问题1:正如您从表中看到的,我的数据集混合了不同尺寸的图像。这会成为训练中的问题吗?并且假设我已经训练了模型并获得了“best.pt”。该模型能否在任何尺寸的图像/视频中有效工作?

问题 2:

我的数据集目录如下所示:

此目录模型是否适合训练。即使我有“test”目录,但似乎该目录根本没有被使用。 “test”文件夹中的图像没有用。 (我知道我在问愚蠢的问题,请直接告诉我。)

如果像这样放置我的所有图像可以吗

我应该需要一个“测试”文件夹吗?

问题3: detector.py 中的“imgsz”是什么?是否对输入源进行下采样?

我在 yolo 呆了超过 3 个星期。我喜欢它,但我发现有些部分很难掌握。请针对这个问题提供建议。提前致谢。

I’m currently working on object detection using yolov5. I trained a model with a custom dataset which has 3 classes = [‘Car’,‘Motorcycle’,‘Person’]

I have many questions related to yolov5.

My dataset consists of

All the custom images are labelled using Roboflow.

question1 : As you can see from the table that my dataset has mix of images with different sizes. Will this be a problem in training? And also assume that i’ve trained the model and got ‘best.pt’. Will that model work efficiently in any dimensions of images/videos.

question 2:

My dataset directory looks like this:

Is this directory model correct for training. Even i have ‘test’ directory but it seems that the directory is not at all used. The images in the ‘test’ folder is useless. ( I know that i’m asking dumb questions, please bare with me.)

Is it ok if place all my images like this

And should i need a ‘test’ folder?

question3: What is the ‘imgsz’ in detect.py? Is it downsampling the input source?

I’ve spent more than 3 weeks in yolo. I love it but i find some parts difficult to grasp. kindly provide suggestion for this questions. Thanks in advance.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

生死何惧 2025-01-23 22:58:10

“问题1:正如您从表中看到的,我的数据集混合了不同尺寸的图像。这会是训练中的问题吗?并且还假设我已经训练了模型并获得了“best.pt”。该模型会吗?在任何尺寸的图像/视频中高效工作。”

  • 只要您将所有图像的大小调整/标准化为相同的正方形大小,那么您应该没问题。 YOLO 在方形图像上进行训练。您可以使用 Roboflow 等平台来处理您的图像,这样它们不仅可以以正确的结构(对于您的图像和注释文件)显示,而且可以在生成数据集时调整它们的大小,以便它们的大小相同。 http://roboflow.com/ - 您只需创建一个公共工作区来上传图像即可免费使用该平台。以下视频介绍了 YOLOv5 的自定义训练:https://www.youtube.com/watch? v=x0ThXHbtqCQ

Roboflow 的 python 包也可用于以编程方式提取图像:https://docs.roboflow.com/python

“这个目录模型是否适合训练。即使我有“test”目录,但似乎该目录根本没有被使用。 “test”文件夹中的图像是无用的(我知道我在问愚蠢的问题,请直接告诉我。)”

  • 是的,训练后的目录模型是正确的。每当我进行 YOLOv5 训练时,我都会得到它。

如果您想对测试文件夹图像运行推理以了解有关模型性能的更多信息,则确实需要一个测试文件夹。

detector.py 中的“imgsz”参数用于设置图像的高度/宽度以进行推理。您将其设置为运行 train.py 时使用的 --img 值。

例如:生成训练图像时将图像大小调整为 640 x 640?使用 (640, 640) 作为“imgsz”参数(这是默认值)。这也意味着您在运行 train.py

YOLOv5 的 Github:获得最佳训练结果的提示https://github.com/ultralytics/yolov5/wiki/Tips-for-Best-Training-Results

Roboflow 的模型制作技巧:https://docs.roboflow.com/model-tips

"question1 : As you can see from the table that my dataset has mix of images with different sizes. Will this be a problem in training? And also assume that i’ve trained the model and got ‘best.pt’. Will that model work efficiently in any dimensions of images/videos."

  • As long as you've resized/normalized all of your images to be the same square size, then you should be fine. YOLO trains on square images. You can use a platform like Roboflow to process your images so they not only come out in the right structure (for your images and annotation files) but also resize them while generating your dataset so they are all the same size. http://roboflow.com/ - you just need to make a public workspace to upload your images to and you can use the platform free. Here's a video that covers custom training with YOLOv5: https://www.youtube.com/watch?v=x0ThXHbtqCQ

Roboflow's python package can also be used to extract your images programmatically: https://docs.roboflow.com/python

"Is this directory model correct for training. Even i have ‘test’ directory but it seems that the directory is not at all used. The images in the ‘test’ folder is useless. ( I know that i’m asking dumb questions, please bare with me.)"

  • Yes that directory model is correct from training. Its what I have whenever I run YOLOv5 training too.

You do need a test folder if you want to run inference against the test folder images to learn more about your model's performance.

The 'imgsz' parameter in detect.py is for setting the height/width of the images for inference. You set it at the value you used for --img when you ran train.py.

For example: Resized images to 640 by 640 when generating your images for training? Use (640, 640) for the 'imgsz' parameter (that is the default value). And that would also mean you set --img to 640 when you ran train.py

YOLOv5's Github: Tips for Best Training Results https://github.com/ultralytics/yolov5/wiki/Tips-for-Best-Training-Results

Roboflow's Model Production Tips: https://docs.roboflow.com/model-tips

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文