def map(self, image_id, image_binary):
     image = resize(imfeat.image_fromstring(image_binary))
     print(image.shape)
     st = time.time()
     box_num = -1
     for box_num, (box, f) in enumerate(feature.image_patch_features_dense(image, normalize_box=True)):
         yield (image_id, box.tolist()), np.dot(self.coefs, f.reshape((f.size, 1))).ravel() + self.intercepts
     hadoopy.counter('stats', 'num_boxes', box_num + 1)
     print('ImageTime[%f]' % (time.time() - st))
Exemple #2
0
 def map(self, image_id, image_binary):
     image = imfeat.image_fromstring(image_binary)
     print(image.shape)
     st = time.time()
     box_num = -1
     for box_num, (box, f) in enumerate(feature.image_patch_features_dense(image, normalize_box=True)):
         scores = np.dot(self.coefs, f.reshape((f.size, 1))) + self.intercepts
         pred_common = [image_id, box.tolist(), f.tolist()]
         for score, preds in zip(scores, self.preds):
             pred = self.output_formatter([float(score[0])] + pred_common)
             if len(preds) >= self.max_hard:
                 heapq.heappushpop(preds, pred)
             else:
                 heapq.heappush(preds, pred)
     hadoopy.counter('stats', 'num_boxes', box_num + 1)
     print('ImageTime[%f]' % (time.time() - st))
 def map(self, image_id, image_binary):
     image = imfeat.image_fromstring(image_binary)
     print(image.shape)
     st = time.time()
     box_num = -1
     for box_num, (box, f) in enumerate(feature.image_patch_features_dense(image, normalize_box=True)):
         scores = np.dot(self.coefs, f.reshape((f.size, 1))) + self.intercepts
         pred_common = [image_id, box.tolist(), f.tolist()]
         for score, preds in zip(scores, self.preds):
             pred = self.output_formatter([float(score[0])] + pred_common)
             if len(preds) >= self.max_hard:
                 heapq.heappushpop(preds, pred)
             else:
                 heapq.heappush(preds, pred)
     hadoopy.counter("stats", "num_boxes", box_num + 1)
     print("ImageTime[%f]" % (time.time() - st))
 def map(self, image_id, image_binary):
     image = imfeat.image_fromstring(image_binary)
     for box, f in feature.image_patch_features_dense(image,
                                                      normalize_box=True):
         yield (image_id, box.tolist()), f
 def map(self, image_id, image_binary):
     image = imfeat.image_fromstring(image_binary)
     for box, f in feature.image_patch_features_dense(image, normalize_box=True):
         yield (image_id, box.tolist()), f