Compare commits

...

6 Commits
v0.1.6 ... main

Author SHA1 Message Date
Wang Xin 04f7d2d259
Create python-publish.yml (#54) 2024-05-17 20:22:09 +08:00
dependabot[bot] b151acd61c
Update pillow requirement from <10.3,>=9.2 to >=9.2,<10.4 (#52)
Updates the requirements on [pillow](https://github.com/python-pillow/Pillow) to permit the latest version.
- [Release notes](https://github.com/python-pillow/Pillow/releases)
- [Changelog](https://github.com/python-pillow/Pillow/blob/main/CHANGES.rst)
- [Commits](https://github.com/python-pillow/Pillow/compare/9.2.0...10.3.0)

---
updated-dependencies:
- dependency-name: pillow
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-04-08 18:45:16 +08:00
Wang Xin 9f21f0adc4
update version (#51) 2024-03-25 20:59:57 +08:00
Wang Xin 513dbc5609
Fix parsing error when `imageData` is empty (#50) 2024-03-24 14:59:09 +08:00
Wang Xin 94382c05f6
add humanized tip (#47) 2024-03-09 21:06:02 +08:00
Wang Xin 1ceae85190
Update README.md (#46) 2024-03-04 21:33:12 +08:00
5 changed files with 47 additions and 6 deletions

39
.github/workflows/python-publish.yml vendored Normal file
View File

@ -0,0 +1,39 @@
# This workflow will upload a Python Package using Twine when a release is created
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python#publishing-to-package-registries
# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.
name: Upload Python Package
on:
release:
types: [published]
permissions:
contents: read
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v3
with:
python-version: '3.x'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install build
- name: Build package
run: python -m build
- name: Publish package
uses: pypa/gh-action-pypi-publish@27b31702a0e7fc50959f5ad993c78deac1bdfc29
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}

View File

@ -2,6 +2,7 @@
[![PyPI - Version](https://img.shields.io/pypi/v/labelme2yolo.svg)](https://pypi.org/project/labelme2yolo)
![PyPI - Downloads](https://img.shields.io/pypi/dm/labelme2yolo?style=flat)
[![PYPI - Downloads](https://static.pepy.tech/badge/labelme2yolo)](https://pepy.tech/project/labelme2yolo)
[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/labelme2yolo.svg)](https://pypi.org/project/labelme2yolo)
[![Codacy Badge](https://app.codacy.com/project/badge/Grade/12122fe86f8643c4aa5667c20d528f61)](https://www.codacy.com/gh/GreatV/labelme2yolo/dashboard?utm_source=github.com\&utm_medium=referral\&utm_content=GreatV/labelme2yolo\&utm_campaign=Badge_Grade)

View File

@ -24,7 +24,7 @@ classifiers = [
]
dependencies = [
"opencv-python>=4.1.2",
"Pillow>=9.2,<10.3",
"Pillow>=9.2,<10.4",
"numpy>=1.23.1,<1.27.0",
"rich"
]

View File

@ -4,4 +4,4 @@
"""
about version
"""
__version__ = "0.1.6"
__version__ = "0.1.7"

View File

@ -137,14 +137,14 @@ def save_yolo_image(json_data, json_dir, image_dir, target_dir, target_name):
"""Save yolo image to image_dir_path/target_dir"""
img_path = os.path.join(image_dir, target_dir, target_name)
if json_data["imageData"] is None:
if json_data["imageData"]:
img = img_b64_to_arr(json_data["imageData"])
PIL.Image.fromarray(img).save(img_path)
else:
image_name = json_data["imagePath"]
src_image_name = os.path.join(json_dir, image_name)
src_image = cv2.imread(src_image_name)
cv2.imwrite(img_path, src_image)
else:
img = img_b64_to_arr(json_data["imageData"])
PIL.Image.fromarray(img).save(img_path)
return img_path
@ -166,6 +166,7 @@ class Labelme2YOLO:
label: label_id for label_id, label in enumerate(label_list)
}
else:
logger.info("Searching label list from json files ...")
# get label list from json files for parallel processing
json_files = glob.glob(
os.path.join(self._json_dir, "**", "*.json"), recursive=True