count += 1 if count % 100 == 0: logger.info('Processing image {}/{}'.format(count, num_imgs)) for cl, cl_boxes in boxes.iteritems(): coords = [] im_name = im_path.split('/')[-1] ar = [] ar_bin = [] for b in cl_boxes: coord_box = {} coord_box['c'] = b['lt'] + b['rb'] coord_box['score'] = float(b['score']) coords.append(coord_box) f = b['f'] f_bin = extractor.binarize_fea(f) im_fea = ImFea() im_fea_bin = ImFeaBin() im_fea.f.extend(f) im_fea_bin.f.extend(f_bin) ar.append(im_fea) ar_bin.append(im_fea_bin) doc = create_doc(im_name, cl, coords, ar, ar_bin) num_docs += 1 # create index action action = {"_index": es_index, "_type": es_type, "_source": doc} actions.append(action) if len(actions) == 1000:
boxes = extractor.extract_regions_and_feats(im, im_name) if len(boxes) == 0: no_faces.append(im_path) if count % 100 == 0: logger.info('Processing image {}/{}'.format(count, 300)) for cl, b in boxes.iteritems(): coords = [] ar = [] ar_bin = [] coord_box = {} coord_box['c'] = b['lt'] + b['rb'] coord_box['score'] = float(b['score']) coords.append(coord_box) f = b['f'] f_bin = extractor.binarize_fea(f) im_fea = ImFea() im_fea_bin = ImFeaBin() im_fea.f.extend(f) im_fea_bin.f.extend(f_bin) ar.append(im_fea) ar_bin.append(im_fea_bin) doc = create_doc(im_name, cl, coords, ar, ar_bin) num_docs += 1 # create index action action = { "_index": es_index, "_type": es_type,