机器学习从图像中标记物体_如何逐步标记图像以进行物体检测

这篇博客介绍了如何使用机器学习技术对图像进行物体标记,以进行物体检测。通过详细步骤,解释了从图像中标记物体的关键过程,涉及到计算机视觉和深度学习的应用。
摘要由CSDN通过智能技术生成

机器学习从图像中标记物体

Labeling image is the first and most significant part of object detection. Labeling is indeed a very time-consuming process, but the more dedication you will give in labeling images, the more accurate your model can be. In this story, I will be discussing the complete approach of labeling in detail. Finally, with this article, you will have your labeled data ready for your object detection model.

标记图像是对象检测的首要也是最重要的部分。 标注确实是一个非常耗时的过程,但是在标注图像时投入的精力越多,模型就越准确。 在这个故事中,我将详细讨论标记的完整方法。 最后,通过本文,您将为您的对象检测模型准备好标记的数据。

Here you will need a tool that is open source to label your data. To download the tool follow the step below.

在这里,您将需要一个开放源代码的工具来标记您的数据。 要下载该工具,请按照以下步骤操作。

Downloading Labeling Tool

下载标签工具

  • If you have Git installed in your machine in open Command Prompt in your device and type

    如果您在设备的打开命令提示符下的计算机中安装了Git,然后键入
git clone https://github.com/pranjalAI/labelImg.git

Installing Dependencies

安装依赖项

  • You need to enter into the “labelImg” folder using command prompt.

    您需要使用命令提示符进入“ labelImg”文件夹。
Image for post
  • After that, you need to install a library called “pyqt5”. Type the below command in your command prompt.

    之后,您需要安装一个名为“ pyqt5”的库。 在命令提示符下键入以下命令。
Image for post
Install pyqt5
安装pyqt5

Defining Custom Classes

定义自定义类

  • You need to go to the “labelImg\data” folder; there you will find predefined_classes.txt Here, you can define your custom classes.

    您需要转到“ labelImg \ data”文件夹; 您将在此处找到预定义的类.txt,您可以在其中定义自定义类。

Activating the “LabelImg” Tool

激活“ LabelImg”工具

In your command prompt, type the following command

在命令提示符下,键入以下命令

Image for post
Launching The LabelImg Tool
启动LabelImg工具
Image for post
Photo by SpaceX on Unsplash
SpaceXUnsplash拍摄
  • After typing the above command, you will see an interactive window, which is an open-source tool.

    输入上述命令后,您将看到一个交互式窗口,这是一个开放源代码工具。
Image for post
The “LabelImg” Tool
“ LabelImg”工具

You will spend a fair amount of time here, As this will help you getting labeled images and make them ready for object detection.

您将在这里花费大量时间,因为这将帮助您获取标记的图像并使它们准备好进行对象检测。

How to Use this tool

如何使用这个工具

  • Click on “Open Dir” and select the folder where you have saved your images that you need to label.

    单击“打开目录”,然后选择保存标签所需的图像的文件夹。
  • Then click on “Change Save Dir” here, you need to select the directory to save your label file. This directory should be different from the image directory.

    然后在这里单击“更改保存目录”,您需要选择目录来保存标签文件。 此目录应与映像目录不同。
  • Now you can use “Create Rectbox” to draw boxes over the images.

    现在,您可以使用“创建矩形框”在图像上方绘制框。
  • Click on the Save button. It will generate a file with the box coordinates.

    单击保存按钮。 它将生成一个带有框坐标的文件。
Image for post
LabelImg Process
标签Craft.io
  • You can draw multiple boxes in an image. It will ask for a class to assign; just select the category that you have defined in the above step.

    您可以在图像中绘制多个框。 它将要求分配一个班级; 只需选择在上一步中定义的类别即可。

Finally, you will now have a folder that will image label data with the same name as your image. Your data is now ready for object detection. Still, if you feel that you have less image count, then please follow my guide to Generate data for object detection. Here, I have shown different image and label augment techniques. If You want to know more about the next steps of object detection, then please do follow my other article Custom Object Detection In Python. Here, I have discussed how you can train your model and can deploy it to the localhost.

最后,您现在将拥有一个文件夹,该文件夹将以与图像相同的名称来图像标签数据。 现在可以准备进行对象检测的数据了。 不过,如果您觉得图像数量较少,请按照我的指南生成用于对象检测的数据 。 在这里,我展示了不同的图像和标签增强技术。 如果您想进一步了解对象检测的后续步骤,请按照我的另一篇文章“ Python中的自定义对象检测”进行 。 在这里,我讨论了如何训练模型并将其部署到本地主机。

Image for post
Photo by John Schnobrich on Unsplash
John SchnobrichUnsplash上的 照片

Some Closing Advice

一些总结建议

Labeling data can be time consuming process but if you want to achieve good accuracy in your model then you must give a good amount of time in this step. Try to collect as much as variety of images from difference resources. The more variety of images you will have the more better your model will be.

标记数据可能是耗时的过程,但是如果您想在模型中获得良好的准确性,则必须在此步骤中花很多时间。 尝试从不同的资源收集尽可能多的图像。 图像种类越多,模型就越好。

翻译自: https://medium.com/swlh/how-to-label-images-for-object-detection-step-by-step-7ee317f98583

机器学习从图像中标记物体

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值