Skip to main content

mask imgs to labelme jsons,and so on

Project description

Build Status

mask2json

mask imgs to labelme jsons,and so on

HOW TO USE

This script is used to convert mask-labels to json files for labelme.

Also ,json files to masks can be found on this site. Sometimes there will be an ERROR,should add this file in labelme path ('../anaconda/Lib/site-packages/labelme/utils ' my path) and add some codes in __init__.py:

from .draw import label_colormap
from .draw import _validate_colormap
from .draw import label2rgb
from .draw import draw_label
from .draw import draw_instances 

Here shows an example using this script.

origin image

img1

mask image

img1

manually_labeled image

img1

auto_labeled image

img1 img1

Also ,for labelimg,a small tool to convert results(yolo) to xml-files. (I tested single object but didn't test multi objects

(1) for labelme mask files

the test script can be found here

from utils import getMultiShapes
getMultiShapes.getMultiShapes(param1,param2,param3,param4)

param1:path which saves the origin imgs param2:path which saves the mask imgs (file names should match the origin imgs) param3:converted json files save path param4:can be blank (better don't), a yaml file path which saves the class information

(2) for labelimg mask files

the test script can be found here

from utils.getMultiShapes import getMultiObjs_voc as gvoc
gvoc(param1,param2,param3)

param1:path which saves the origin imgs param2:path which saves the mask imgs (file names should match the origin imgs) param3:converted xml files save path

(3) for json files to mask files

the test script can be found here

from utils.convert import processor
processor(param1,param2)

param1:json file or folder param2:can be blank,encoding type, default 'utf-8'

AILERNATIVE

you can try:

pip install convertmask

it is a test release. : )

SHORTCOMING

1.objects connected to each other is not supported yet.

this may happen if you labelling multiple-object-images with only 2 labels .Or some objects are of the same type and are connected to each other(eg. a bunch of grapes,it is hard to split one to the other).

LOGS

2020.6.12

support multiple objects mask to json

try test.py !

multiple objects in different classes

manually_labeled image

img1

auto_labeled image

img1

multiple objects in same classes

manually_labeled image

img1

auto_labeled image

img1

2020.7.10

a lot of things to do ,such as many warnings related to labelme.

2020.7.13

convert multi objects to xml files supported (untested)

2020.7.14

bugfix , test multi objects to xml files, pretty xmls

eg:

img1

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

convertmask-0.2.tar.gz (13.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

convertmask-0.2-py3-none-any.whl (23.2 kB view details)

Uploaded Python 3

File details

Details for the file convertmask-0.2.tar.gz.

File metadata

  • Download URL: convertmask-0.2.tar.gz
  • Upload date:
  • Size: 13.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/47.3.1.post20200622 requests-toolbelt/0.9.1 tqdm/4.47.0 CPython/3.7.7

File hashes

Hashes for convertmask-0.2.tar.gz
Algorithm Hash digest
SHA256 4f36fef1f8fe4cb7abba35d2a75c7c9af7f36cd29ac8b39cdde8e1f72aa5fea2
MD5 f963121cda6dd9d8d1193eda11f400b2
BLAKE2b-256 d6af5aa3513ccf9fbd70ca225d148c2d9e159cf0f2c895723896e5065adbae56

See more details on using hashes here.

File details

Details for the file convertmask-0.2-py3-none-any.whl.

File metadata

  • Download URL: convertmask-0.2-py3-none-any.whl
  • Upload date:
  • Size: 23.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/47.3.1.post20200622 requests-toolbelt/0.9.1 tqdm/4.47.0 CPython/3.7.7

File hashes

Hashes for convertmask-0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 231ac21e2e8cc33a2803d1f6ea391594f0f75f3a61121f0b3965f5a7d479b7d9
MD5 64a82a33fce6e5efcf87fdb070538d59
BLAKE2b-256 188f9562c020d72244aabcec28ac1171fa3df2b24ad98a4a3cc26b35d7a17483

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page