Hello, thank you for your help. I tried to make my own custom recipe but I can’t get what I want. Here’s my code:
import prodigy
from prodigy.components.loaders import Images
from prodigy.util import b64_uri_to_bytes
from prodigy.components.db import connect
import glob
import os
import sys
#permet de modifier les exemples avant qu’ils ne soient placés dans la base de données.
#examples liste Liste d’exemples de dictionnaires annotés.
def before_db(examples,data_source_directory):
liste_image = glob.glob(data_source_directory + '/*.jpg')
for eg in examples:
# If the image is a base64 string and the path to the original file
# is present in the task, remove the image data
if eg["image"].startswith("data:"):
for image in liste_image:
if eg["meta"]["file"] in os.path.basename(image):
eg["image"] = data_source_directory+"/"+eg["meta"]["file"]
eg["path"]=eg["image"]
return examples
@prodigy.recipe("modify-images",
dataset_name=("The dataset to use", "positional", None, str),
data_source_directory=("data_image_directory", "positional", None, str),
loader=("Comma-separated label(s)", "option", "i", str),
label=("Comma-separated label(s)", "option", "l", list))
def modify_images(dataset_name:str,data_source_directory:str, loader, label):
db = connect()
examples = db.get_dataset(dataset_name)
examples=before_db(examples,data_source_directory)
return{
"dataset":dataset_name,
"stream" :examples,
"view_id": loader,
}
What I try to do here is that when I annotate with the "image.manual" function of the photos from my personal files, and I save the annotated images , well, I no longer have access to them at all, I cannot make any changes or corrections.
With this code I would like to again have access to my annotated dataset and be able to modify it.
I find it strange that prodigy does not propose a function or recipe so that one can after saving the annotated images , return to modify or correct these annotations.
I executed the following command:
prodigy modify-images testv ../Downloads/OneDrive_1_29_08_2022 --loader image --label FENETRE_OUVERTE,FENETRE_FERMEE,PORTE_OUVERTE,PORTE_FERMEE -F ./recipe.py
thank you in advance