Detailed Component Design
Item Storage
- the item we store are images. Hence it is not suitable to keep it in database as it takes too much space and will cost the system significantly
- we store the images in object storage such as AWS S3. As it is a lot cheaper. And we assign image_id for every image and map it with S3 url.
Suggest Tag Service & Normalize Tag Service
- for both service the key action we need to do is to compare if the item/name is similar to what already existed in the system
- for suggestion, we used tag from the image that is similar to item in question to recommend the tag
- for name, we check if there exist name that is similar to the incoming name if so we just return the existing name
- we can archive this using embedding (Deep Learning Model) combine with cosine similarity algorithm
- First we need to feed image/text into the model (different model) then we will receive vector representing our input. We run cosine similarity algorithm (|input_vector||existing_vector| cos(angle)/|input_vector||existing_vector|)
- for image model, we just choose top5 images that is has cos value greater than predefine value (gain by experiment) and suggest those tags.
- For text model, we check if there is vector that has cos value greater than predefine value and if so we just return the top vector that is similar to the input
Search
- in this case we will just need to receive the input tags
- then check in cache/db if there is image_id that satisfies the condition
- return the list of image