def __init__(self, path, max_images=-1):
        super(ImageCaption, self).__init__(name=None)

        self.path = path
        print 'Reading train images and sentences from %s' % self.path
        self.read_images('train')
        self.load_vocab()

        trainSents, trainImgs = [], []
        for i, img_sent in enumerate(self.iterImageSentencePair()):
            if len(trainSents) > max_images and max_images > 0:
                break
            trainImgs.append(img_sent['image'])
            sent = [self.end_token] + [x for x in img_sent['sentence']['tokens']
                                       if x in self.vocab_to_index]
            trainSents.append(sent[:self.max_sentence_length])

        self.nbatches = len(trainImgs) // self.be.bsz
        self.ndata = self.nbatches * self.be.bsz

        self.X = np.zeros((len(trainSents), self.max_sentence_length))
        self.y = np.zeros((len(trainSents), self.max_sentence_length+1))
        self.images = np.vstack(trainImgs)

        self.sent_length = np.array([len(x)+1 for x in trainSents])
        self.sent_ends = np.arange(self.max_sentence_length+1)[:, np.newaxis]
        for sent_idx, sent in enumerate(trainSents):
            self.X[sent_idx, :len(sent)] = [self.vocab_to_index[word] for word in sent]
        self.y[:, :-1] = self.X
Returns all properties which are `select types`.
dataset/ETHPy150Open NervanaSystems/neon/neon/data/imagecaption.py/ImageCaption.__init__--crossover with--dataset/ETHPy150Open diefenbach/django-lfs/lfs/catalog/models.py/Product.get_variants_properties