-
-
Notifications
You must be signed in to change notification settings - Fork 13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add a price_tags
table to store predictions
#611
Comments
Thanks for the detailed issue ! A few remarks:
|
I get your point, but to me there is a difference between the
The fact we have different models specific to different type of proofs was the reason we created a generic
I agree that the AI should be optional from the backend side. And the user should be allowed to draw bounding boxes manually using the web app to create new price tags. |
But I don't understand how with your current |
We don't store multiple predictions (ex: we don't store 2 price prediction by 2 different models). On Robotoff, it turns out after a couple of years that we never needed predictions from 2 models at the same time: when a new model is trained and tested, I just delete all the predictions associated with this model and relaunch the model on all images. edit: to make thing clearer, we can store in the current schema of the |
Ok but I would be in favor to have the flexibility to do any number of predictions, for instance ones coming from Gemini, and another coming from our own model, and have both show up in the UI to help the user, or help us test/compare while we transition out of GenAI, no ? That's why I like the JSONField where we can have any number of predictions :) |
If you want to keep the flexibility to have any number of predictions of the same type, it's better to have a |
Updated schema, after the discussions above: Schemas
|
price_tags
tableprice_tags
table to store predictions
In #526, we've talked about how to speed up price addition using ML/AI (#526 (comment)).
For price tags, the workflow seems now clear:
Step (2) is currently in development. Once the proof is uploaded, we would ideally run all ML models as an async job.
For each detected price tag, we need to store some information:
I suggest we create a new
price_tags
table. Storing intermediate data in a new table is necessary to allow performing async processing. The user won't have to wait for models to run, and we can distribute workload (=price validation) between contributors. Besides, it allows having gold truth data evaluating and training models that extract information from price tags.Schema
id
: ID of the price tagproof_id
: FK to the proofcreated
: creation datetimeupdated
: datetime of last updatebounding_box
: the coordinates of the bounding box, in relative coordinated as (y_min, x_min, y_max, x_max). The origin is the top-left corner of the image.status
: The status of the price tag: either a price is already linked for this price tag (status=1), it may be waiting for approval or completion (status=null
), or it may be invalid (status=0
, the information cannot be read or is hidden). Onlyprice_tag
s withnull
status will be suggested in a "Hunger Games-like" games.Fields pre-filled by the extraction model (currently Gemini):
predicted_product_code
predicted_category_tag
predicted_price
predicted_price_per
predicted_price_is_discounted
price_without_discount
predicted_currency
predicted_labels_tags
predicted_origins_tags
Fields that are derived from predictions, validated by the user. These fields are null before the price tag is validated by the user.
price
price_is_discounted
price_without_discount
price_per
product_code
category_tag
currency
labels_tags
origins_tags
models_info
(JSONB): extra information about the version of the models that generated the prediction, about which model was used for what, etc.We can add a nullable
price_tag_id
in theprices
table to keep track of the individual price tag that is behind a price.Workflow
When a new proof is uploaded, the price tag object detector model is run on the image of the proof. We create one element in the
price_tags
table for each detected price tag (above a fixed threshold).For each detected price tag, we run the Gemini model on it and save the results in the
predicted_*
fields.The
status
of theprice_tag
is null by default. Users can validate the extracted data by calling an endpoint to retrieve allprice_tag
s withnull
status. Once validated, a new price is created linked with the originalprice_tag
using theprice_tag_id
foreign key.The text was updated successfully, but these errors were encountered: