vanstorm9 / yugioh-one-shot-learning

One shot learning (image recognition) on 10,856 unique Yugioh cards
96 stars 19 forks source link

featureMap_withSift dictionary #2

Closed sanariaz154 closed 3 years ago

sanariaz154 commented 3 years ago

@vanstorm9 first of all Thankyou for the code and article, it's really useful... What is the purpose of featureMap-withShift-***.pkl file and how can I create it for my own dataset?

vanstorm9 commented 3 years ago

Thanks! And the purpose of "featureMap-withShift-***.pkl" is to essentially a dictionary that stores the activation maps on all cards in Yugioh ahead of time so that it can be used in prediction time (as opposed to doing forward-propagation on over 10,000 images on the spot). It effectively speeds up prediction time of the model by a massive magnitude.

You can view more information about its purpose and analysis here under "Speed up model prediction process" section: https://towardsdatascience.com/i-made-an-ai-to-recognize-over-10-000-yugioh-cards-26fc6aed1588

As for creating your own, you would use the dict scripts located here: https://github.com/vanstorm9/yugioh-one-shot-learning/tree/main/dictScripts

You would change the paths within the scripts and run "dictCreate.py", "dictUnify.py", and "dictTest.py" in that order.

dictCreate.py will iterate through your dataset and create multiple pkl files (since if your dataset is huge, it will be hard to fit your dictionary of activation maps into RAM).

You then run "dictUnify.py" to combine all the pkl files into a large pkl file (your large dictionary of activation maps).

You can also choose to run "dictTest.py" to see if the model you are using and the dictionary you are using are linked to each other (so that if you are handling multiple dictionaries and models, you won't get confused with which goes with and verify that they are linked to each other).

I hope that answers your question.

sanariaz154 commented 3 years ago

@vanstorm9 Thank you for the detailed answer, it helped a lot. Can you tell me how much did you augment the data to achieve the final accuracy, i.e how many examples per class? Also, what transformations did you apply for the augmentation?

vanstorm9 commented 3 years ago

@sanariaz154 For the transformations used during augmentation, you can view that information here on line 165: https://github.com/vanstorm9/yugioh-one-shot-learning/blob/main/train.py

Essentially there were a variety of affine transformations (translate, scale, shear) as well as changing in contrast, hue, brightness, and saturation. I am not too sure on how many augmented images were added to each class though. The more the better though.