api_instance = Images() image = {} image['file'] = "xxxkkkx" image['source'] = 'deepfashion' size = {} size['width'] = 300 size['height'] = 500 size['depth'] = 3 objects = [] object = {} box = {} box['x1'] = 10.0 box['y1'] = 10.0 box['x2'] = 40.0 box['y2'] = 60.0 object['name'] = 'xxx' object['box'] = box objects.append(object) image['size'] = size image['objects'] = objects try: api_response = api_instance.add_image(image) pprint(api_response) except Exception as e: print("Exception when calling ProductApi->add_object: %s\n" % e)
attribute_clothes = get_attribute_clothes() attribute_images = get_attribute_images(attribute_clothes) i = 0 for img in attribute_images: image = {} image['file'] = img['file'] image['source'] = 'deepfashion' width, height = get_image_size(img['file']) image['width'] = width image['height'] = height image['category_class'] = category_images[i]['type'] image['category_name'] = category_images[i]['name'] image['texture_class'] = attribute_images[i]['texture_class'] image['fabric_class'] = attribute_images[i]['fabric_class'] image['shape_class'] = attribute_images[i]['shape_class'] image['part_class'] = attribute_images[i]['part_class'] image['style_class'] = attribute_images[i]['style_class'] image['bbox'] = bboxes[i] i = i + 1 try: id = dataset_api.add_image(image) url = upload_image_to_storage(id, image['file']) image['_id'] = ObjectId(id) image['url'] = url dataset_api.update_image(image) except Exception as e: print(e)