quaterion.dataset.similarity_samples module
- class SimilarityGroupSample(obj: Any, group: int)[source]
Bases:
object
Represent groups of similar objects all of which should match with one-another within the group.
Examples:
Faces dataset. All pictures of a single person should have single unique group id. In this case NN will learn to match all pictures within the group closer to each-other, but pictures from different groups - further. file_name group_id 0 elon_musk_1.jpg 555 1 elon_musk_2.jpg 555 2 elon_musk_3.jpg 555 3 leonard_nimoy_1.jpg 209 4 leonard_nimoy_2.jpg 209
- class SimilarityPairSample(obj_a: Any, obj_b: Any, score: float = 1.0, subgroup: int = 0)[source]
Bases:
object
Represents a pair of objects, their similarity and relationship with other pairs.
Examples:
data = [ # First query group (subgroup) SimilarityPairSample( obj_a="cheesecake", obj_b="muffins", score=0.9, subgroup=10 ), SimilarityPairSample( obj_a="cheesecake", obj_b="macaroons", score=0.8, subgroup=10 ), SimilarityPairSample( obj_a="cheesecake", obj_b="candies", score=0.7, subgroup=10 ), # Second query group (subgroup) SimilarityPairSample( obj_a="lemon", obj_b="lime", score=0.9, subgroup=11 ), SimilarityPairSample( obj_a="lemon", obj_b="orange", score=0.7, subgroup=11 ), ]