Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
- [Sequential PCD](#sequential-pcd)
- [DICOM](#dicom)
- [Common](#common)
- [Appendix](#appendix)
- [Annotation](#annotation)
- [Project](#project)
- [Dataset](#dataset)
Expand Down Expand Up @@ -2174,6 +2175,35 @@ Example of a single history object
}
```


## Appendix

Processing of various types of appendix information is supported.

### Import Camera Calibration

Import camera calibration and image appendix information for tasks in pcd and sequential pcd projects.


```python
client.import_appendix_file(project="YOUR_PROJECT_SLUG", file_path="ZIP_FILE_PATH")
```

The folder structure inside the ZIP file is as follows

```
.
└── task_name
├── content_name_1.pcd
│   ├── 000001.png
│   └── 000001.yaml
└── content_name_2.pcd
├── 000002.png
├── 000002.yaml
├── 000003.png
└── 000003.yaml
```

## Annotation

### Create Annotation
Expand Down
26 changes: 26 additions & 0 deletions fastlabel/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -1974,6 +1974,32 @@ def create_sequential_pcd_task(

return self.api.post_request(endpoint, payload=payload)

def import_appendix_file(
self,
project: str,
file_path: str,
) -> list:
"""
Import calibration file zip.
project is slug of your project (Required).
file_path is a path to data. Supported extensions are zip (Required).
"""

if not utils.is_appendix_supported_ext(file_path):
raise FastLabelInvalidException("Supported extensions are zip.", 422)

endpoint = "contents/imports/appendix/batch"
payload = {"project": project}
signed_url = self.__get_signed_path(
project=project,
file_name=os.path.basename(file_path),
file_type="application/zip",
)
self.api.upload_zipfile(url=signed_url["url"], file_path=file_path)
payload["fileKey"] = signed_url["name"]

return self.api.post_request(endpoint, payload=payload)

# Task Update

def update_task(
Expand Down
4 changes: 4 additions & 0 deletions fastlabel/utils/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,10 @@ def is_dicom_supported_ext(file_path: str) -> bool:
return file_path.lower().endswith((".zip"))


def is_appendix_supported_ext(file_path: str) -> bool:
return file_path.lower().endswith((".zip"))


def is_pcd_supported_ext(file_path: str) -> bool:
# .ply is not yet supported. To support it, modification of the API
# needs to be considered as well.
Expand Down