> ## Documentation Index
> Fetch the complete documentation index at: https://docs.epigos.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Project

> Manage project and upload dataset into your projects in Epigos AI.

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

<Note>
  You'll need to [Create an API Key](/workspace/api-keys) to
  [Authentication](/api-reference/introduction#authentication) with Epigos AI.
</Note>

# 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.

```python theme={null}
# 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.

| Param                      | Type   | Description                                                                                                                                                |
| -------------------------- | ------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `image_path`               | string | Path or directory to images to upload.                                                                                                                     |
| `annotation_path`          | string | Optional 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_name`               | string | Name of batch to upload to within project. Defaults to `sdk-upload`.                                                                                       |
| `box_format`               | string | Format of annotation to upload. Options are (`coco`, `pascal_voc`, `yolo`). Defaults to `pascal_voc`.                                                      |
| `labels_map`               | dict   | Optional Epigos AI label ID to class name mapping. Useful to skip creating labels if it's already created in Epigos AI.                                    |
| `yolo_labels_map`          | dict   | Optional class ID to label name mapping for YOLO annotations. Used to map numeric YOLO label ID's to actual class names.                                   |
| `batch_id`                 | string | Optional 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_name` | bool   | Optional flag to indicate whether to use parent folder name of image is class label for image classification dataset.                                      |

#### Upload file for image classification

```python theme={null}
record = project.upload(
  "path/to/image.jpg",
  use_folder_as_class_name=True,
)
print(record)
```

#### Upload image with COCO annotation

```python theme={null}
record = project.upload(
  "path/to/image.jpg",
  annotation_path="path/to/coco.json",
  box_format="coco"
)
print(record)
```

#### Upload image with Pascal VOC annotation

```python theme={null}
record = project.upload(
  "path/to/image.jpg",
  annotation_path="path/to/image.xml",
  box_format="pascal_voc"
)
print(record)
```

#### Upload image with YOLO annotation

```python theme={null}
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
```

| Param              | Type    | Description                                                          |
| ------------------ | ------- | -------------------------------------------------------------------- |
| `images_directory` | string  | Path to directory containing images to upload.                       |
| `batch_name`       | string  | Name of batch to upload to within project. Defaults to `sdk-upload`. |
| `num_workers`      | integer | Number of cpu workers to use for uploading. Defaults to `4`          |

```python theme={null}
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.

| Param              | Type    | Description                                                                                                             |
| ------------------ | ------- | ----------------------------------------------------------------------------------------------------------------------- |
| `images_directory` | string  | Path to directory containing images to upload.                                                                          |
| `annotations_path` | string  | Path to file containing COCO annotations JSON file.                                                                     |
| `batch_name`       | string  | Name of batch to upload to within project. Defaults to `sdk-upload`.                                                    |
| `labels_map`       | dict    | Optional Epigos AI label ID to class name mapping. Useful to skip creating labels if it's already created in Epigos AI. |
| `num_workers`      | integer | Number of cpu workers to use for uploading. Defaults to `4`                                                             |

```python theme={null}
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.

| Param                   | Type    | Description                                                                                                             |
| ----------------------- | ------- | ----------------------------------------------------------------------------------------------------------------------- |
| `images_directory`      | string  | Path to directory containing images to upload.                                                                          |
| `annotations_directory` | string  | Path to directory containing PASCAL VOC annotations.                                                                    |
| `batch_name`            | string  | Name of batch to upload to within project. Defaults to `sdk-upload`.                                                    |
| `labels_map`            | dict    | Optional Epigos AI label ID to class name mapping. Useful to skip creating labels if it's already created in Epigos AI. |
| `num_workers`           | integer | Number of cpu workers to use for uploading. Defaults to `4`                                                             |

```python theme={null}
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.

| Param                   | Type    | Description                                                                                                             |
| ----------------------- | ------- | ----------------------------------------------------------------------------------------------------------------------- |
| `images_directory`      | string  | Path to directory containing images to upload.                                                                          |
| `annotations_directory` | string  | Path to directory containing YOLO annotations.                                                                          |
| `data_yaml_path`        | string  | Path to file containing YOLO data configuration file yaml.                                                              |
| `batch_name`            | string  | Name of batch to upload to within project. Defaults to `sdk-upload`.                                                    |
| `labels_map`            | dict    | Optional Epigos AI label ID to class name mapping. Useful to skip creating labels if it's already created in Epigos AI. |
| `num_workers`           | integer | Number of cpu workers to use for uploading. Defaults to `4`                                                             |

```python theme={null}
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](https://github.com/Epigos-AI/epigos-python)
