Epigos offers an API that allows you to upload dataset to your projects. This API is accessible within the Epigos Python SDK.

You’ll need to Create an API Key to Authentication with Epigos AI.

Managing Projects

To manage projects, you can use the Project class:

project()

Retrieves a project from Epigos AI and returns the Project class that can be used to upload datasets.

# Load project
project = client.project("project_id")
print(project)

Upload dataset

You have the option to upload images alongside annotations suitable for tasks such as object detection and classification.

upload()

You can upload a single image along with its annotation to the project. Currently supported annotation formats are Pascal VOC and YOLO.

ParamTypeDescription
image_pathstringPath or directory to images to upload.
annotation_pathstringOptional path to annotation file to annotate the image. For image classification, this will be used as class label if use_folder_as_class_name is false.
batch_namestringName of batch to upload to within project. Defaults to sdk-upload.
box_formatstringFormat of annotation to upload. Options are (coco, pascal_voc, yolo). Defaults to pascal_voc.
labels_mapdictOptional Epigos AI label ID to class name mapping. Useful to skip creating labels if it’s already created in Epigos AI.
yolo_labels_mapdictOptional class ID to label name mapping for YOLO annotations. Used to map numeric YOLO label ID’s to actual class names.
batch_idstringOptional batch ID if batch is already created in Epigos AI. If not provided, batch_name is used to create/retrieve a batch from Epigos AI.
use_folder_as_class_nameboolOptional flag to indicate whether to use parent folder name of image is class label for image classification dataset.

Upload file for image classification

record = project.upload(
  "path/to/image.jpg",
  use_folder_as_class_name=True,
)
print(record)

Upload image with COCO annotation

record = project.upload(
  "path/to/image.jpg",
  annotation_path="path/to/coco.json",
  box_format="coco"
)
print(record)

Upload image with Pascal VOC annotation

record = project.upload(
  "path/to/image.jpg",
  annotation_path="path/to/image.xml",
  box_format="pascal_voc"
)
print(record)

Upload image with YOLO annotation

record = project.upload(
  "path/to/image.jpg",
  annotation_path="path/to/image.txt",
  box_format="yolo"
)
print(record)

upload_classification_dataset()

You can upload an entire image classification dataset folder. This is useful when you have multiple images in a directory.

The parent folder of the images will be used as categories for the image. Below is a sample of how the directory should look like.

root/dog/xxx.jpg
root/dog/xxy.jpg
root/dog/[...]/xxz.jpg

root/cat/123.jpg
root/cat/nsdf3.jpg
root/cat/[...]/asd932_.jpg
ParamTypeDescription
images_directorystringPath to directory containing images to upload.
batch_namestringName of batch to upload to within project. Defaults to sdk-upload.
num_workersintegerNumber of cpu workers to use for uploading. Defaults to 4
records = project.upload_classification_dataset(
  "path/to/folder",
)
print(tuple(records))

upload_coco_dataset()

You can upload an entire folder containing COCO annotations and images. This is useful when you have multiple images in a directory.

ParamTypeDescription
images_directorystringPath to directory containing images to upload.
annotations_pathstringPath to file containing COCO annotations JSON file.
batch_namestringName of batch to upload to within project. Defaults to sdk-upload.
labels_mapdictOptional Epigos AI label ID to class name mapping. Useful to skip creating labels if it’s already created in Epigos AI.
num_workersintegerNumber of cpu workers to use for uploading. Defaults to 4
records = project.upload_coco_dataset(
  images_directory="path/to/dataset/train/images",
  annotations_path="path/to/dataset/train/coco.json",
)
print(tuple(records))

upload_pascal_voc_dataset()

You can upload an entire folder containing PASCAL VOC annotations and images. This is useful when you have multiple images in a directory.

ParamTypeDescription
images_directorystringPath to directory containing images to upload.
annotations_directorystringPath to directory containing PASCAL VOC annotations.
batch_namestringName of batch to upload to within project. Defaults to sdk-upload.
labels_mapdictOptional Epigos AI label ID to class name mapping. Useful to skip creating labels if it’s already created in Epigos AI.
num_workersintegerNumber of cpu workers to use for uploading. Defaults to 4
records = project.upload_pascal_voc_dataset(
  images_directory="path/to/dataset/train/images",
  annotations_directory="path/to/dataset/train/labels",
)
print(tuple(records))

upload_yolo_dataset()

You can upload an entire folder containing YOLO annotations and images. This is useful when you have multiple images in a directory.

ParamTypeDescription
images_directorystringPath to directory containing images to upload.
annotations_directorystringPath to directory containing YOLO annotations.
data_yaml_pathstringPath to file containing YOLO data configuration file yaml.
batch_namestringName of batch to upload to within project. Defaults to sdk-upload.
labels_mapdictOptional Epigos AI label ID to class name mapping. Useful to skip creating labels if it’s already created in Epigos AI.
num_workersintegerNumber of cpu workers to use for uploading. Defaults to 4
records = project.upload_yolo_dataset(
  images_directory="path/to/dataset/train/images",
  annotations_directory="path/to/dataset/train/labels",
  data_yaml_path="path/to/dataset/data.yaml",
)
print(tuple(records))

Checkout the code on Github