1. 安装
1.创建conda虚拟环境
(base) PS C:\Users\13241>conda create -n label python=3.10
输出
Collecting package metadata (current_repodata.json): done
Solving environment: done
## Package Plan ##
environment location: C:\Users\13241\miniconda3\envs\label
added / updated specs:
- python=3.10
The following packages will be downloaded:
package | build
---------------------------|-----------------
openssl-3.0.12 | h2bbff1b_0 7.4 MB
pip-23.3.1 | py310haa95532_0 2.9 MB
python-3.10.13 | he1021f5_0 15.8 MB
setuptools-68.0.0 | py310haa95532_0 934 KB
wheel-0.41.2 | py310haa95532_0 127 KB
------------------------------------------------------------
Total: 27.1 MB
The following NEW packages will be INSTALLED:
bzip2 pkgs/main/win-64::bzip2-1.0.8-he774522_0
ca-certificates pkgs/main/win-64::ca-certificates-2023.08.22-haa95532_0
libffi pkgs/main/win-64::libffi-3.4.4-hd77b12b_0
openssl pkgs/main/win-64::openssl-3.0.12-h2bbff1b_0
pip pkgs/main/win-64::pip-23.3.1-py310haa95532_0
python pkgs/main/win-64::python-3.10.13-he1021f5_0
setuptools pkgs/main/win-64::setuptools-68.0.0-py310haa95532_0
sqlite pkgs/main/win-64::sqlite-3.41.2-h2bbff1b_0
tk pkgs/main/win-64::tk-8.6.12-h2bbff1b_0
tzdata pkgs/main/noarch::tzdata-2023c-h04d1e81_0
vc pkgs/main/win-64::vc-14.2-h21ff451_1
vs2015_runtime pkgs/main/win-64::vs2015_runtime-14.27.29016-h5e58377_2
wheel pkgs/main/win-64::wheel-0.41.2-py310haa95532_0
xz pkgs/main/win-64::xz-5.4.2-h8cc25b3_0
zlib pkgs/main/win-64::zlib-1.2.13-h8cc25b3_0
Proceed ([y]/n)? y
Downloading and Extracting Packages
Preparing transaction: done
Verifying transaction: done
Executing transaction: done
#
# To activate this environment, use
#
# $ conda activate label
#
# To deactivate an active environment, use
#
# $ conda deactivate
2.激活label环境
(base) PS C:\Users\13241>conda activate label
3.安装 labelimg库
(label) PS C:\Users\13241>pip install labelimg
输出
Collecting labelimg
Downloading labelImg-1.8.6.tar.gz (247 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 247.7/247.7 kB 92.7 kB/s eta 0:00:00
Preparing metadata (setup.py) ... done
Collecting pyqt5 (from labelimg)
Downloading PyQt5-5.15.10-cp37-abi3-win_amd64.whl.metadata (2.2 kB)
Collecting lxml (from labelimg)
Downloading lxml-4.9.3-cp310-cp310-win_amd64.whl.metadata (3.9 kB)
Collecting PyQt5-sip<13,>=12.13 (from pyqt5->labelimg)
Downloading PyQt5_sip-12.13.0-cp310-cp310-win_amd64.whl.metadata (524 bytes)
Collecting PyQt5-Qt5>=5.15.2 (from pyqt5->labelimg)
Downloading PyQt5_Qt5-5.15.2-py3-none-win_amd64.whl (50.1 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 50.1/50.1 MB 116.6 kB/s eta 0:00:00
Downloading lxml-4.9.3-cp310-cp310-win_amd64.whl (3.8 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 3.8/3.8 MB 157.9 kB/s eta 0:00:00
Downloading PyQt5-5.15.10-cp37-abi3-win_amd64.whl (6.8 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 6.8/6.8 MB 221.4 kB/s eta 0:00:00
Downloading PyQt5_sip-12.13.0-cp310-cp310-win_amd64.whl (78 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 78.5/78.5 kB 174.5 kB/s eta 0:00:00
Building wheels for collected packages: labelimg
Building wheel for labelimg (setup.py) ... done
Created wheel for labelimg: filename=labelImg-1.8.6-py2.py3-none-any.whl size=261580 sha256=4c4585c343ff3d4523554f9573ddcc31a4d19434e90d11dc8ad55163e0b179d6
Stored in directory: c:\users\13241\appdata\local\pip\cache\wheels\d9\f0\1e\74c509495458cad13a0fda23fe605e643177625cf2b5c17b34
Successfully built labelimg
Installing collected packages: PyQt5-Qt5, PyQt5-sip, lxml, pyqt5, labelimg
Successfully installed PyQt5-Qt5-5.15.2 PyQt5-sip-12.13.0 labelimg-1.8.6 lxml-4.9.3 pyqt5-5.15.10
4.使用lambimg
(label) PS C:\Users\13241> lamblimg
5.安装 labelme库
(label) PS C:\Users\13241> pip install labelme
输出
Collecting labelme
Using cached labelme-5.3.1.tar.gz (1.5 MB)
Preparing metadata (setup.py) ... done
Collecting gdown (from labelme)
Using cached gdown-4.7.1-py3-none-any.whl (15 kB)
Collecting imgviz>=0.11 (from labelme)
Using cached imgviz-1.7.4-py3-none-any.whl.metadata (5.6 kB)
Collecting matplotlib (from labelme)
Using cached matplotlib-3.8.2-cp310-cp310-win_amd64.whl.metadata (5.9 kB)
Collecting natsort>=7.1.0 (from labelme)
Using cached natsort-8.4.0-py3-none-any.whl.metadata (21 kB)
Collecting numpy (from labelme)
Using cached numpy-1.26.2-cp310-cp310-win_amd64.whl.metadata (61 kB)
Collecting onnxruntime>=1.14.1 (from labelme)
Using cached onnxruntime-1.16.3-cp310-cp310-win_amd64.whl.metadata (4.5 kB)
Collecting Pillow>=2.8 (from labelme)
Using cached Pillow-10.1.0-cp310-cp310-win_amd64.whl.metadata (9.6 kB)
Collecting PyYAML (from labelme)
Using cached PyYAML-6.0.1-cp310-cp310-win_amd64.whl.metadata (2.1 kB)
Collecting qtpy!=1.11.2 (from labelme)
Using cached QtPy-2.4.1-py3-none-any.whl.metadata (12 kB)
Collecting scikit-image (from labelme)
Using cached scikit_image-0.22.0-cp310-cp310-win_amd64.whl.metadata (13 kB)
Collecting termcolor (from labelme)
Using cached termcolor-2.3.0-py3-none-any.whl (6.9 kB)
Collecting colorama (from labelme)
Using cached colorama-0.4.6-py2.py3-none-any.whl (25 kB)
Collecting coloredlogs (from onnxruntime>=1.14.1->labelme)
Using cached coloredlogs-15.0.1-py2.py3-none-any.whl (46 kB)
Collecting flatbuffers (from onnxruntime>=1.14.1->labelme)
Using cached flatbuffers-23.5.26-py2.py3-none-any.whl.metadata (850 bytes)
Collecting packaging (from onnxruntime>=1.14.1->labelme)
Using cached packaging-23.2-py3-none-any.whl.metadata (3.2 kB)
Collecting protobuf (from onnxruntime>=1.14.1->labelme)
Using cached protobuf-4.25.1-cp310-abi3-win_amd64.whl.metadata (541 bytes)
Collecting sympy (from onnxruntime>=1.14.1->labelme)
Using cached sympy-1.12-py3-none-any.whl (5.7 MB)
Collecting filelock (from gdown->labelme)
Using cached filelock-3.13.1-py3-none-any.whl.metadata (2.8 kB)
Collecting requests[socks] (from gdown->labelme)
Using cached requests-2.31.0-py3-none-any.whl.metadata (4.6 kB)
Collecting six (from gdown->labelme)
Using cached six-1.16.0-py2.py3-none-any.whl (11 kB)
Collecting tqdm (from gdown->labelme)
Using cached tqdm-4.66.1-py3-none-any.whl.metadata (57 kB)
Collecting beautifulsoup4 (from gdown->labelme)
Using cached beautifulsoup4-4.12.2-py3-none-any.whl (142 kB)
Collecting contourpy>=1.0.1 (from matplotlib->labelme)
Using cached contourpy-1.2.0-cp310-cp310-win_amd64.whl.metadata (5.8 kB)
Collecting cycler>=0.10 (from matplotlib->labelme)
Using cached cycler-0.12.1-py3-none-any.whl.metadata (3.8 kB)
Collecting fonttools>=4.22.0 (from matplotlib->labelme)
Using cached fonttools-4.45.1-cp310-cp310-win_amd64.whl.metadata (158 kB)
Collecting kiwisolver>=1.3.1 (from matplotlib->labelme)
Using cached kiwisolver-1.4.5-cp310-cp310-win_amd64.whl.metadata (6.5 kB)
Collecting pyparsing>=2.3.1 (from matplotlib->labelme)
Using cached pyparsing-3.1.1-py3-none-any.whl.metadata (5.1 kB)
Collecting python-dateutil>=2.7 (from matplotlib->labelme)
Using cached python_dateutil-2.8.2-py2.py3-none-any.whl (247 kB)
Collecting scipy>=1.8 (from scikit-image->labelme)
Using cached scipy-1.11.4-cp310-cp310-win_amd64.whl.metadata (60 kB)
Collecting networkx>=2.8 (from scikit-image->labelme)
Using cached networkx-3.2.1-py3-none-any.whl.metadata (5.2 kB)
Collecting imageio>=2.27 (from scikit-image->labelme)
Using cached imageio-2.33.0-py3-none-any.whl.metadata (4.9 kB)
Collecting tifffile>=2022.8.12 (from scikit-image->labelme)
Using cached tifffile-2023.9.26-py3-none-any.whl.metadata (30 kB)
Collecting lazy_loader>=0.3 (from scikit-image->labelme)
Using cached lazy_loader-0.3-py3-none-any.whl.metadata (4.3 kB)
Collecting soupsieve>1.2 (from beautifulsoup4->gdown->labelme)
Using cached soupsieve-2.5-py3-none-any.whl.metadata (4.7 kB)
Collecting humanfriendly>=9.1 (from coloredlogs->onnxruntime>=1.14.1->labelme)
Using cached humanfriendly-10.0-py2.py3-none-any.whl (86 kB)
Collecting charset-normalizer<4,>=2 (from requests[socks]->gdown->labelme)
Using cached charset_normalizer-3.3.2-cp310-cp310-win_amd64.whl.metadata (34 kB)
Collecting idna<4,>=2.5 (from requests[socks]->gdown->labelme)
Using cached idna-3.5-py3-none-any.whl.metadata (9.9 kB)
Collecting urllib3<3,>=1.21.1 (from requests[socks]->gdown->labelme)
Using cached urllib3-2.1.0-py3-none-any.whl.metadata (6.4 kB)
Collecting certifi>=2017.4.17 (from requests[socks]->gdown->labelme)
Using cached certifi-2023.11.17-py3-none-any.whl.metadata (2.2 kB)
Collecting PySocks!=1.5.7,>=1.5.6 (from requests[socks]->gdown->labelme)
Using cached PySocks-1.7.1-py3-none-any.whl (16 kB)
Collecting mpmath>=0.19 (from sympy->onnxruntime>=1.14.1->labelme)
Using cached mpmath-1.3.0-py3-none-any.whl (536 kB)
Collecting pyreadline3 (from humanfriendly>=9.1->coloredlogs->onnxruntime>=1.14.1->labelme)
Using cached pyreadline3-3.4.1-py3-none-any.whl (95 kB)
Using cached imgviz-1.7.4-py3-none-any.whl (7.7 MB)
Using cached natsort-8.4.0-py3-none-any.whl (38 kB)
Using cached onnxruntime-1.16.3-cp310-cp310-win_amd64.whl (7.4 MB)
Using cached numpy-1.26.2-cp310-cp310-win_amd64.whl (15.8 MB)
Using cached Pillow-10.1.0-cp310-cp310-win_amd64.whl (2.6 MB)
Using cached QtPy-2.4.1-py3-none-any.whl (93 kB)
Downloading matplotlib-3.8.2-cp310-cp310-win_amd64.whl (7.6 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 7.6/7.6 MB 31.0 kB/s eta 0:00:00
Downloading PyYAML-6.0.1-cp310-cp310-win_amd64.whl (145 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 145.3/145.3 kB 38.4 kB/s eta 0:00:00
Downloading scikit_image-0.22.0-cp310-cp310-win_amd64.whl (24.5 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 24.5/24.5 MB 36.9 kB/s eta 0:00:00
Downloading contourpy-1.2.0-cp310-cp310-win_amd64.whl (186 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 186.7/186.7 kB 30.1 kB/s eta 0:00:00
Using cached cycler-0.12.1-py3-none-any.whl (8.3 kB)
Downloading fonttools-4.45.1-cp310-cp310-win_amd64.whl (2.2 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 2.2/2.2 MB 34.9 kB/s eta 0:00:00
Downloading imageio-2.33.0-py3-none-any.whl (313 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 313.3/313.3 kB 29.5 kB/s eta 0:00:00
Downloading kiwisolver-1.4.5-cp310-cp310-win_amd64.whl (56 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 56.1/56.1 kB 26.2 kB/s eta 0:00:00
Downloading lazy_loader-0.3-py3-none-any.whl (9.1 kB)
Downloading networkx-3.2.1-py3-none-any.whl (1.6 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1.6/1.6 MB 30.6 kB/s eta 0:00:00
Using cached packaging-23.2-py3-none-any.whl (53 kB)
Using cached pyparsing-3.1.1-py3-none-any.whl (103 kB)
Downloading scipy-1.11.4-cp310-cp310-win_amd64.whl (44.1 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 44.1/44.1 MB 31.1 kB/s eta 0:00:00
Downloading tifffile-2023.9.26-py3-none-any.whl (222 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 222.9/222.9 kB 23.4 kB/s eta 0:00:00
Using cached filelock-3.13.1-py3-none-any.whl (11 kB)
Downloading flatbuffers-23.5.26-py2.py3-none-any.whl (26 kB)
Downloading protobuf-4.25.1-cp310-abi3-win_amd64.whl (413 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 413.4/413.4 kB 31.7 kB/s eta 0:00:00
Using cached tqdm-4.66.1-py3-none-any.whl (78 kB)
Downloading certifi-2023.11.17-py3-none-any.whl (162 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 162.5/162.5 kB 34.6 kB/s eta 0:00:00
Downloading charset_normalizer-3.3.2-cp310-cp310-win_amd64.whl (100 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 100.3/100.3 kB 53.4 kB/s eta 0:00:00
Downloading idna-3.5-py3-none-any.whl (61 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 61.6/61.6 kB 78.2 kB/s eta 0:00:00
Downloading soupsieve-2.5-py3-none-any.whl (36 kB)
Downloading urllib3-2.1.0-py3-none-any.whl (104 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 104.6/104.6 kB 66.3 kB/s eta 0:00:00
Using cached requests-2.31.0-py3-none-any.whl (62 kB)
Building wheels for collected packages: labelme
Building wheel for labelme (setup.py) ... done
Created wheel for labelme: filename=labelme-5.3.1-py3-none-any.whl size=1472284 sha256=fccf779957dea23334cdf3d225e6e5b8b8e41f07d3e01b434f932cc20bd23b82
Stored in directory: c:\users\13241\appdata\local\pip\cache\wheels\32\d6\4d\f22a84b8a82543c9db037748207ca29ccf8167c3b55a169959
Successfully built labelme
Installing collected packages: pyreadline3, mpmath, flatbuffers, urllib3, termcolor, sympy, soupsieve, six, PyYAML, PySocks, pyparsing, protobuf, Pillow, packaging, numpy, networkx, natsort, lazy_loader, kiwisolver, idna, humanfriendly, fonttools, filelock, cycler, colorama, charset-normalizer, certifi, tqdm, tifffile, scipy, requests, qtpy, python-dateutil, imageio, contourpy, coloredlogs, beautifulsoup4, scikit-image, onnxruntime, matplotlib, imgviz, gdown, labelme
Successfully installed Pillow-10.1.0 PySocks-1.7.1 PyYAML-6.0.1 beautifulsoup4-4.12.2 certifi-2023.11.17 charset-normalizer-3.3.2 colorama-0.4.6 coloredlogs-15.0.1 contourpy-1.2.0 cycler-0.12.1 filelock-3.13.1 flatbuffers-23.5.26 fonttools-4.45.1 gdown-4.7.1 humanfriendly-10.0 idna-3.5 imageio-2.33.0 imgviz-1.7.4 kiwisolver-1.4.5 labelme-5.3.1 lazy_loader-0.3 matplotlib-3.8.2 mpmath-1.3.0 natsort-8.4.0 networkx-3.2.1 numpy-1.26.2 onnxruntime-1.16.3 packaging-23.2 protobuf-4.25.1 pyparsing-3.1.1 pyreadline3-3.4.1 python-dateutil-2.8.2 qtpy-2.4.1 requests-2.31.0 scikit-image-0.22.0 scipy-1.11.4 six-1.16.0 soupsieve-2.5 sympy-1.12 termcolor-2.3.0 tifffile-2023.9.26 tqdm-4.66.1 urllib3-2.1.0
6.使用lambme
(label) PS C:\Users\13241> labelme
输出
[INFO ] __init__:get_config:70 - Loading config file from: C:\Users\13241\.labelmerc
2. lambimg
2.1 界面
2.2 使用
在我们进行标注时,我们可以在Anaconda Prompt中实时查看到标注情况。
标注完所有图像之后就可以查看标记结果了,注意这里我们进行标注时有两种标记数据的格式一种是PascalVoc,另外一种是YOLO,这里以常见的VOC数据集格式进行标注,最终得到以xml格式的标注数据。
Voc数据集的数据格式,包含对象名,标记框的基本信息。
至此,用labelimg制作数据集的过程到此结束,就可以去训练YOLO的模型了。
3. labelme
3.1 界面
3.2 使用
如图所示,我们可以进行矩形标注、点标注、以及圆形标注等多种格式进行标注,界面的上的按钮的作用和labelimg类似,这里不再赘述。
相对于labelimg,我们可以以多种形式进行数据标注,如下图:
标注完后进行保存save,图片上标注的信息将以json文格式将进行保存,如下图:
4. 总结
labelimg标注完数据之后以.xml数据的格式进行保存,只能创建矩形框更加适用于目标检测制作数据集,如YOLO,而labelme以.json文件的数据格式进行保存,可以创建多种类型的边框进行标注,适用于图像分割,如MaskRcnn。