extract-image
You need to be a Pro member to access the full content of this.
extract-image
converts a JSON file that contains image data to a file without by extracting the imageData to a JPEG file.
Why do you want to use this tool
Labelme by default saves the image you’re annotating into the JSON file as "imageData"
.
This is useful since you can copy or move the JSON file anywhere and still open the file.
However, when you want to keep the original image file (like JPEG/PNG format), you will have duplicate image data stored both in the JSON and the image file. This wastes your storage.
For the new annotation, you can use labelme --nodata
option to stop storing "imageData"
, but we need to do the conversion for old files.
This is when extract-image
comes in.
Usage
Pass either a JSON file or directory of JSON files to the command.
labelmetk extract-image [OPTIONS] FILE_OR_DIR
Example: Convert a JSON file
If you only have a single JSON file, pass it to the command:
labelmetk extract-image dogs.json
Example: Convert a directory of JSON files
If you have multiple JSON files in a directory, pass the directory to the command:
labelmetk extract-image small_dataset
Download an example dataset from:
small_dataset.zip (389KB)