Mask_RCNN
Mask_RCNN copied to clipboard
How to join single .json to one annotation.json file as MS COCO
Hi, I used labelme to create .json file for each image of my own, but I want to join them into one file annotation.json file as the one in MS COCO, please show me how, thanks
I guess you will have to write your own method to put all that together. The json file is just a formatted text so you can find a way to read each file one by one, take the required info you need and save it into a single file. The coco json file structure was explained by me in https://github.com/matterport/Mask_RCNN/issues/297
@fastlater: thanks for your help. The annotations folder contains .json files that I don't quite get the differences among them and the relation between those files. I am mentioning captions_train2014.json; captions_val2014.json; instances_train2014.json and instances_val2014.json. Can you help me with this? When we train the model, from coco.py, only instances_train2014.json and instances_val2014.json are used, neither captions files, so the caption-ones are for what?
@AliceDinh Captions files are for generating a sentence to describe the image. For image caption.
@AliceDinh you can use labelme2coco package to convert your annotations to coco format. It is really easy.
Installation:
pip install labelme2coco
Usage:
# import package
import labelme2coco
# set directory that contains labelme annotations and image files
labelme_folder = "tests/data/labelme_annot"
# set path for coco json to be saved
save_json_path = "tests/data/test_coco.json"
# conert labelme annotations to coco
labelme2coco.convert(labelme_folder, save_json_path)
@fcakyon I tried using the code you provided to convert labelme annotations to coco format but I'm getting this error "AttributeError: module 'labelme2coco' has no attribute 'convert'" . Could you please assist on the way forward?
@loyanie Can you tell me more on your setup? Are you on Linux? Have you installed the package via pip or did you setup from the source? If from pip, which version of the package have you installed? Are you on a conda environment? What is your Python version?
Im asking these questions because I have no issues using the "convert" method.
@loyanie Can you tell me more on your setup? Are you on Linux? Have you installed the package via pip or did you setup from the source? If from pip, which version of the package have you installed? Are you on a conda environment? What is your Python version?
Im asking these questions because I have no issues using the "convert" method.
I'm currently using windows 10 installed with anaconda and python 3.7.3, the labelme2coco package was installed using pip command.
yes...thank you .. labelme2coco is installed for me ...thanks a lot