I'm working on project that needs to deal with images, I extract their feature vector instantly when any image uploaded then I store the feature vectors in MySQL database as text per each image.
Also I'm using django framework.
def search_images_by_features(query_image: ImageFieldFile, images):
featured_images = [
(calculate_similarity(load_features_from_str(image.features), get_image_feature(query_image)), image.item) for image in
images if image.features is not None]
...
But looping on each image isn't a big deal as it takes more time as images increase.
Also my feature vector in database stored like that:
0.0010601664,0.0003533888,0.8969008,0.0014135552,...
Also is there a way to make MySQL database engine calculate similarity from feature vectors?