class DeepFeatureRep(interface): r''' mean_F: \mathbb{R}^{N x H x W x 3} \to \mathbb{R}^{D} F_inverse: \mathbb{R}^{D} \to \mathbb{R}^{H x W x 3} mean_F achieves O(1) space wrt N if X is an iterator that yields \mathbb{R}^{H x W x 3}. ''' mean_F = method(['self', 'X']) F_inverse = method(['self', 'F', 'initial_image'], keywords='options')
class AttributeClassifier(interface): r''' lookup_scores: returns precomputed scores given a list of strings score: \mathbb{R}^{N x H x W x 3} \to \mathbb{R}^{N x K} fields: list of K strings select: constraints is a list of 2-tuples (field index, value), attributes is \mathbb{R}^{K}. Returns a list of image file paths which satisfy the given constraints and are sorted by minkowski distance (over some set of fields) to the given attribute vector. score also accepts a list of N strings. ''' lookup_scores = method(['self', 'X'], keywords='options') score = method(['self', 'X'], keywords='options') fields = method(['self']) select = method(['self', 'constraints', 'attributes'], keywords='options')
class comestible(interface): eat = method(['self']) buy_from = method(['self', 'supermarket']) mix_with = method(['self'], varargs='ingredients') cook_with = method(['self'], keywords='ingredients') cook = method(['self', 'temperature'], defaults=1)