doccano-client
doccano-client copied to clipboard
create example image
Feature description
I love to create and configure project using the doccano-client. Thanks a lot for this work ! I'm used to do it with project related to text data.
But is it also possible with images ?
For example is the method create_example able to upload an image as an example for a doccano project ? It looks like it was made for texts only (I think the images features are quite recent for doccano)
https://github.com/doccano/doccano-client/blob/fe125f409138d319fb1c74a0d3c41225c539e7f8/doccano_api_client/init.py#L310
I have the same question. I have a project for "Image Classification", and i would like to programmatically import the dataset, instead of dragging/dropping via the web ui.
Could this be done with sync with Cloud storage services (AWS S3, Google Cloud Storage, Azure Blob Storage) ? Like with label-studio : the python sdk of label studio even can sync the input and output of the labelling. It is vers convinient
I think I figured out how to upload an image (to an image related project).
img_fp = open('my_image.jpg', 'rb')
resp = client.post_doc_upload_binary(project_id=project_id, files=[img_fp], format='ImageFile')
The basic seemed simple enough, however, I can't yet figure out how to attach metadata to this example (adding annotation).
@kechan did you figure out how to attach metadata on the image example upload? I am looking to do the exact same thing...
@kechan did you figure out how to attach metadata on the image example upload? I am looking to do the exact same thing...
I figured this out for anyone who is curious... there may be a different method (that I couldn't find), but this was my approach using the rest api directly (enabled by the client) -- you just need to replace the my_proj_id and my_ex_id variables and create a doccano_client connection
url = f'v1/projects/{my_proj_id}/examples/{my_ex_id}'
payload = {
"meta": json.dumps({"url": "https://github.com/doccano/doccano-client"})
}
resp = doccano_client.update(url, data=payload)
NOTE: this is run after uploading the example to the project