Beispiel #1
0
def main(_):
    dataset_api = Images()
    writer = tf.python_io.TFRecordWriter(FLAGS.output_path)

    offset = 0
    limit = 50

    while True:
        try:
            res = dataset_api.get_images_by_source("deepfashion",
                                                   offset=offset,
                                                   limit=limit)

            for image in res:
                print(image)
                exit(1)
                tf_data = dict_to_tf_example(image)
                writer.write(tf_data.SerializeToString())

            if limit > len(res):
                print("done")
                break
            else:
                offset = offset + len(res)
        except Exception as e:
            print(str(e))

    writer.close()
def load_image_into_numpy_array(image):
  (im_width, im_height) = image.size
  return np.array(image.getdata()).reshape(
    (im_height, im_width, 3)).astype(np.uint8)


if __name__ == '__main__':
  print('start')
  image_api = Images()
  offset = 0
  limit = 100

  while True:
    images = None
    try:
      images = image_api.get_images_by_source("deepfashion", offset, limit)
    except Exception as e:
      print(str(e))

    if len(images) == 0:
      break
    else:
      offset = offset + limit


    for img in images:
      if 'url_with_box' in img:
        continue

      img_file = download_image(img.get('url'))
      image = Image.open(img_file)
Beispiel #3
0
from __future__ import print_function
from stylelens_dataset.images import Images
from pprint import pprint
# create an instance of the API class
api_instance = Images()

try:
    api_response = api_instance.get_images_by_source("deepfashion")
    pprint(api_response)
except Exception as e:
    print("Exception when calling get_images_by_source: %s\n" % e)
Beispiel #4
0
    return uploaded_path


if __name__ == '__main__':
    print('start')

    image_api = Images()
    object_api = Objects()

    offset = 0
    limit = 100

    while True:
        try:
            res = image_api.get_images_by_source(source='deepfashion',
                                                 offset=offset,
                                                 limit=limit)

            for image in res:
                cropped_file = crop(image)
                image['url'] = cropped_file
                image['image_id'] = str(image['_id'])
                image['bbox'] = None
                image['width'] = None
                image['height'] = None
                object_api.add_object(image)

            if limit > len(res):
                break
            else:
                offset = offset + limit