Image Annotation - to show only the label of class at the time of annotation in multiple classes

Hello, I'm working on a object detection project in which at initial stage there are 24 objects and the classes will further increase in forth coming future. We are using using prodigy for object annotation.

current dataset directory:

dataset
|-class_name_1
|- 1.jpg
|- 2.jpg
|-class_name_2
|- 1.jpg
|- 2.jpg
:
:
|-class_name_n
|- 1.jpg
|- 2.jpg

What problem we're facing is that giving all the labels at same time and selecting the label form the list of labels while annotation is pretty hectic task. So we're planning to create a recipe which will dynamically choose the label as folder name from the image path but unable to do so because recipe return all values in dictionary all in one time.

Also we have tried to run the for loop on each folder in dataset but once the recipe returns the values for one folder it stops.

Hi! So if I understand your question correctly, you want to use a different label in the UI, based on the folder the image is in?

The approach you describe make sense and you can achieve this by overriding the default recipe config (which also defines the labels) on a per-tasks basis, using the key "config". So the data you send out could look like this:

{"image": "...", "config": {"labels": ["class_name_1"]}}
{"image": "...", "config": {"labels": ["class_name_2"]}}

This should definitely work if you're writing a custom loader – are you sure your generator is set up correctly and doesn't return/exit? You should be able to loop over multiple directories and then yield the images from them.