<div id="top"></div>
<!--
*** Thanks for checking out the Best-README-Template. If you have a suggestion
*** that would make this better, please fork the repo and create a pull request
*** or simply open an issue with the tag "enhancement".
*** Don't forget to give the project a star!
*** Thanks again! Now go create something AMAZING! :D
-->
<!-- PROJECT SHIELDS -->
<!--
*** I'm using markdown "reference style" links for readability.
*** Reference links are enclosed in brackets [ ] instead of parentheses ( ).
*** See the bottom of this document for the declaration of the reference variables
*** for contributors-url, forks-url, etc. This is an optional, concise syntax you may use.
*** https://www.markdownguide.org/basic-syntax/#reference-style-links
-->
[![PyPI](https://img.shields.io/pypi/v/labelme2datasets.svg)](https://pypi.python.org/pypi/labelme2datasets)
[![PythonVersion](https://img.shields.io/pypi/pyversions/labelme2datasets.svg)](https://pypi.org/project/labelme2datasets)
[![Pylint](https://github.com/veraposeidon/labelme2Datasets/actions/workflows/pylint.yml/badge.svg)](https://github.com/veraposeidon/labelme2Datasets/actions/workflows/pylint.yml)
[![codebeat badge](https://codebeat.co/badges/ab6b3bb6-213b-4a4f-ac55-277dd2840f28)](https://codebeat.co/projects/github-com-veraposeidon-labelme2datasets-main)
[![chinese][zh-sheild]][zh-url]
<br />
[![Contributors][contributors-shield]][contributors-url]
[![Forks][forks-shield]][forks-url]
[![Stargazers][stars-shield]][stars-url]
[![Issues][issues-shield]][issues-url]
[![MIT License][license-shield]][license-url]
<!-- PROJECT LOGO -->
<br />
<div align="center">
<a href="https://github.com/veraposeidon/labelme2Datasets">
<img src="images/logo.png" alt="Logo" width="80" height="80">
</a>
<h3 align="center">labelme2Datasets</h3>
<p align="center">
用于将 LabelMe 标注的数据转换为 VOC 格式和 COCO 格式的数据集。
<br />
<a href="https://github.com/veraposeidon/labelme2Datasets/issues">Report Bug</a>
·
<a href="https://github.com/veraposeidon/labelme2Datasets/issues">Request Feature</a>
</p>
</div>
[English README Available](https://github.com/veraposeidon/labelme2Datasets//blob/main/README.en.md)
<!-- TABLE OF CONTENTS -->
<details>
<summary>Table of Contents</summary>
<ol>
<li>
<a href="#about-the-project">About The Project</a>
<ul>
<li><a href="#built-with">Built With</a></li>
</ul>
</li>
<li>
<a href="#getting-started">Getting Started</a>
<ul>
<li><a href="#prerequisites">Prerequisites</a></li>
<li><a href="#installation">Installation</a></li>
</ul>
</li>
<li><a href="#usage">Usage</a></li>
<li><a href="#roadmap">Roadmap</a></li>
<li><a href="#contributing">Contributing</a></li>
<li><a href="#license">License</a></li>
<li><a href="#contact">Contact</a></li>
<li><a href="#acknowledgments">Acknowledgments</a></li>
</ol>
</details>
<!-- ABOUT THE PROJECT -->
## About The Project
仓库中的脚本用于将 [labelme](https://github.com/wkentaro/labelme) 标注的数据转换为 [PASCAL VOC](http://host.robots.ox.ac.uk/pascal/VOC/) 格式和 [MS COCO](https://cocodataset.org/#home) 格式的数据集,便于直接利用支持这两种格式的框架进行训练。
脚本都使用 [Python](https://www.python.org/) 写的。
大部分的脚步都是参考的 labelme 项目中的 [examples](https://github.com/wkentaro/labelme/tree/main/examples) 内容。然后添加一些根据自己的数据集自定义的功能,比如标签转换、自定义图像名称等。
**注意**:这些脚本其实并不复杂,有 Python 基础的同学可以过一遍转换的流程,确保在你的数据集上是可以正常运行的。有一些地方我标注了 `MARK`,表示在这些地方需要留意,可以根据自己的需要进行修改。
**拓展**:这些脚本当时只是用来转换我自己的数据集。如果你需要转换其他领域的数据集,比如实例分割、语义分割或者视频标注等等。建议去 lebelme 的 [examples](https://github.com/wkentaro/labelme/tree/main/examples) 部分看看,作者提供了一些示例代码,可以参考。
<p align="right">(<a href="#top">back to top</a>)</p>
### Built With
* [Python](https://www.python.org/)
* [labelme](https://github.com/wkentaro/labelme)
* [imgviz](https://github.com/wkentaro/imgviz)
<p align="right">(<a href="#top">back to top</a>)</p>
<!-- GETTING STARTED -->
## Getting Started
### Prerequisites
1. 将 lebelme 标注得到的 JSON 文件放在一个文件夹内。举个例子,命名为 `labelme_jsons_dir`。
2. 准备好一份 text 文本,里面包含数据集的分类标签。举个例子,命名为 `label_names.txt`。可以参考下项目里的 `test/label_names.txt`。
3. 如果有转换标签的需求(比如中文标签转为英文),准备一个文本,包含转换的规则,举个例子,命名为`label_dict.txt`。可以参考下项目里的 `test/label_dict.txt` 。
### Installation
#### develop mode 安装
1. 建议使用虚拟环境安装 Python Package。
```sh
conda create --name=labelme python=3.6
conda activate labelme
pip install -r requirements.txt
```
2. 克隆仓库。
```sh
git clone git@github.com:veraposeidon/labelme2Datasets.git
```
3. 本地安装
```sh
cd labelme2Datasets
# (推荐)可编辑模式安装,即可以修改代码
pip install -e .
# 第二种安装方式,可以直接运行脚本,但是不能修改代码
#python setup.py install
```
#### 直接使用 PyPI
同时发布了一个 PyPI package,[labelme2datasets](https://pypi.org/project/labelme2datasets/)。
可以直接使用 `pip3 install labelme2datasets` 进行安装。
如果项目中的流程不适用于你的数据集,建议通过上述 develop mode 安装和修改代码。
<p align="right">(<a href="#top">back to top</a>)</p>
<!-- USAGE EXAMPLES -->
## Usage
- 转换单个 JSON 文件。 (`labelme_json2dataset.py`)
```sh
labelme_json2dataset --json_file=data/test.json \
--output_dir=output/test_single_output
```
- 转换 JSON 文件夹`labelme_jsons_dir` 到 VOC 格式的数据集。 (`labelme_bbox_json2voc.py`)
- 需要标签转换
```sh
labelme_bbox_json2voc --json_dir=data/test_jsons \
--output_dir=output/test_voc_output --labels data/label_names.txt
```
- 不需要标签转换
```sh
labelme_bbox_json2voc --json_dir=data/test_jsons \
--output_dir=output/test_voc_output \
--labels data/label_names.txt \
--label_dict data/label_dict.txt
```
- 分割 VOC 数据的训练集和测试集。 (`split_voc_datasets.py`)
```sh
split_voc_datasets --voc_dir output/test_voc_output --test_ratio 0.3 --random_seed 42
```
`train.txt` 和 `test.txt` 会出现在 `voc_dir/ImageSets/Main/` 文件夹下。
- 将 VOC 数据集转换为 COCO 数据集 (`voc2coco.py`)
```shell
voc2coco --voc_dir output/test_voc_output --coco_dir output/test_coco_output
```
<p align="right">(<a href="#top">back to top</a>)</p>
<!-- ROADMAP -->
## Roadmap
- [x] 将所有的脚本都通过 Pylint
- [x] 中英文 README
- [x] 调整项目结构
- [x] 发布 Pypi 包
See the [open issues](https://github.com/veraposeidon/labelme2Datasets/issues) for a full list of proposed features (and known issues).
<p align="right">(<a href="#top">back to top</a>)</p>
<!-- CONTRIBUTING -->
## Contributing
如果你有什么建议可以让这个项目变得更好,可以 Fork 项目并且提交 Pull Request。
也可以简单地在 [issues](https://github.com/veraposeidon/labelme2Datasets/issues) 中开一个 issue。
1. Fork the Project
2. Create your Feature Branch (`git checkout -b feature/AmazingFeature`)
3. Commit your Changes (`git commit -m 'Add some AmazingFeature'`)
4. Push to the Branch (`git push or
没有合适的资源?快使用搜索试试~ 我知道了~
温馨提示
将 labelme 标注的数据转换为 PASCAL VOC 格式和 MS COCO 格式的数据集,便于直接利用支持这两种格式的框架进行训练 使用方法 1、将 lebelme 标注得到的 JSON 文件放在一个文件夹内。举个例子,命名为 labelme_jsons_dir。 2、准备好一份 text 文本,里面包含数据集的分类标签。举个例子,命名为 label_names.txt。可以参考下项目里的 test/label_names.txt。 3、如果有转换标签的需求(比如中文标签转为英文),准备一个文本,包含转换的规则,举个例子,命名为label_dict.txt。可以参考下项目里的 test/label_dict.txt 。
资源推荐
资源详情
资源评论
收起资源包目录
labelme2Datasets-main.zip (43个子文件)
labelme2Datasets-main
setup.py 1KB
.github
workflows
python-publish.yml 1KB
pylint.yml 772B
data
test.json 143KB
label_dict.txt 180B
label_names.txt 103B
test_jsons
20180928115538.json 877KB
20180928115522.json 746KB
20180928115506.json 686KB
LICENSE 1KB
output
test_voc_output
class_names.txt 87B
ImageSets
Main
test.txt 15B
train.txt 30B
Annotations
20180928115506.xml 800B
20180928115522.xml 800B
20180928115538.xml 800B
JPEGImages
20180928115538.jpg 629KB
20180928115506.jpg 494KB
20180928115522.jpg 535KB
AnnotationsVisualization
20180928115538.jpg 642KB
20180928115506.jpg 502KB
20180928115522.jpg 545KB
test_coco_output
train
20180928115538.jpg 629KB
20180928115506.jpg 494KB
test
20180928115522.jpg 535KB
annotations
test.json 1KB
train.json 2KB
test_single_output
label_names.txt 102B
img.png 852KB
label_viz.png 511KB
label.png 8KB
labelme2datasets
utils.py 1KB
__init__.py 0B
labelme_json2dataset.py 3KB
labelme_bbox_json2voc.py 9KB
voc2coco.py 6KB
split_voc_datasets.py 2KB
requirements.txt 143B
.gitignore 1KB
images
logo.png 9KB
.pylintrc 17KB
README.en.md 10KB
README.md 10KB
共 43 条
- 1
资源评论
云哲-吉吉2021
- 粉丝: 3214
- 资源: 1130
下载权益
C知道特权
VIP文章
课程特权
开通VIP
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- 论文(最终)_20240430235101.pdf
- 基于python编写的Keras深度学习框架开发,利用卷积神经网络CNN,快速识别图片并进行分类
- 最全空间计量实证方法(空间杜宾模型和检验以及结果解释文档).txt
- 5uonly.apk
- 蓝桥杯Python组的历年真题
- 2023-04-06-项目笔记 - 第一百十九阶段 - 4.4.2.117全局变量的作用域-117 -2024.04.30
- 2023-04-06-项目笔记 - 第一百十九阶段 - 4.4.2.117全局变量的作用域-117 -2024.04.30
- 前端开发技术实验报告:内含4四实验&实验报告
- Highlight Plus v20.0.1
- 林周瑜-论文.docx
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功