-
Is there a way to use image_annotation, that allows the user to just label images, rather than label an annotate? Currently, the only way I can an image labeled with a downloadable json file is by allowing annotations. |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 1 reply
-
Hey @ltrenary. Can you describe what is the difference between labeling and annotating in your mind? Do you want to assign a single label to the whole image rather than multiple annotations to objects within the image? |
Beta Was this translation helpful? Give feedback.
-
Hi @mturoci! Your last question is inline with what I'm thinking. My language may be a bit imprecise. When referring to labeling, the idea is that user would tag a single-class image with a label - this is more inline with creating a dataset for a classifier. For annotation, the user would be provided a multi-class image and would localize an object by drawing a rectangle around it and assigning the corresponding label - this is more inline with creating a dataset for an object detector. I'm interested in the former - creating an app that allows the user to label an image. The localization isn't necessary, since we are considering only images of a single-class. Is this possible? Many thanks. |
Beta Was this translation helpful? Give feedback.
-
Gotcha. In that case, image_annotator is not the best choice since it focuses on "multi-class" image anotations. However, single-class classification is not hard to do as well. You need a wizard like interface:
Here is a rough minimal code: from h2o_wave import Q, ui, main, app
images = [
'https://images.pexels.com/photos/15953914/pexels-photo-15953914.jpeg?auto=compress&cs=tinysrgb&w=400&lazy=load',
'https://images.pexels.com/photos/6282599/pexels-photo-6282599.jpeg?auto=compress&cs=tinysrgb&w=400&lazy=load'
]
choices = [
ui.choice('house', 'House'),
ui.choice('girl', 'Girl'),
]
@app('/')
async def serve(q: Q):
if not q.client.initialized: # First visit, create an empty form card for our wizard
q.page['form'] = ui.form_card(box='1 1 7 9', items=[
ui.choice_group(name='choices', label='Choices', choices=choices, required=True, inline=True),
ui.image(title='', path=images[0]),
ui.button(name='next', label='Next', primary=True),
])
q.client.initialized = True
if q.args.next:
print(q.args.choices) # Save the choice with the corresponding image.
q.page['form'].items[1].image.path = images[1]
await q.page.save() Demo: Screen.Recording.2023-03-22.at.4.11.24.PM.mov |
Beta Was this translation helpful? Give feedback.
Gotcha.
In that case, image_annotator is not the best choice since it focuses on "multi-class" image anotations.
However, single-class classification is not hard to do as well. You need a wizard like interface:
Here is a rough minimal code: