semantic-segmentation-editor
semantic-segmentation-editor copied to clipboard
Add a JSON import feature
Thank you for good tool. I would like to load auto-annotated json files. Is it possible?
No it's not possible for now. Let's create a feature request.
Has anyone worked on this?
Hello @brappazzo, nothing new on this feature, feel free to provide a PR. Thanks.
I am trying to work on this, any suggestions on the best approach?
First draw some polygons then look at the content of the mongo database, the goal is to inject data with the same format. Then you will need a server-side service to inject the JSON into mongo, you can take inspiration from server/files.js or server/api.js. The transfered data could be a regular file or directly the JSON content.
I hope this helps, I will be happy to review your pull request if you plan to submit one.
You can inject json into mongo using below code:
from pymongo import MongoClient
class SseHelper:
def __init__(self):
¦ client = MongoClient('127.0.0.1:3001')
¦ db = client.meteor
¦ self.SseSamples = db.SseSamples
def get_anno(self, filename: str):
¦ url = "/" + filename.replace("/", "%2F")
¦ anno = self.SseSamples.find_one({"url": url})
¦ return anno
def set_anno(self, filename: str, anno: dict):
¦ url = "/" + filename.replace("/", "%2F")
¦ self.SseSamples.update_one({"url": url}, {"$set": anno})
def add_anno(self, anno: dict):
¦ ret = self.SseSamples.insert_one(anno)
if __name__ == "__main__":
sse = SseHelper()
query = "/test/1.png"
anno = sse.get_anno(query)
# load your anno from json file
anno["objects"].pop(0)
sse.set_anno("/test/1.png", anno)
# sse.add_anno(new_anno)