Skip to content

Commit f0364e4

Browse files
Merge pull request #234 from fastlabel/add-import-appendix
add import appendix
2 parents b8f1bb9 + eeb5fb0 commit f0364e4

File tree

3 files changed

+60
-0
lines changed

3 files changed

+60
-0
lines changed

README.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
- [Sequential PCD](#sequential-pcd)
2121
- [DICOM](#dicom)
2222
- [Common](#common)
23+
- [Appendix](#appendix)
2324
- [Annotation](#annotation)
2425
- [Project](#project)
2526
- [Dataset](#dataset)
@@ -2174,6 +2175,35 @@ Example of a single history object
21742175
}
21752176
```
21762177

2178+
2179+
## Appendix
2180+
2181+
Processing of various types of appendix information is supported.
2182+
2183+
### Import Camera Calibration
2184+
2185+
Import camera calibration and image appendix information for tasks in pcd and sequential pcd projects.
2186+
2187+
2188+
```python
2189+
client.import_appendix_file(project="YOUR_PROJECT_SLUG", file_path="ZIP_FILE_PATH")
2190+
```
2191+
2192+
The folder structure inside the ZIP file is as follows
2193+
2194+
```
2195+
.
2196+
└── task_name
2197+
├── content_name_1.pcd
2198+
│   ├── 000001.png
2199+
│   └── 000001.yaml
2200+
└── content_name_2.pcd
2201+
├── 000002.png
2202+
├── 000002.yaml
2203+
├── 000003.png
2204+
└── 000003.yaml
2205+
```
2206+
21772207
## Annotation
21782208

21792209
### Create Annotation

fastlabel/__init__.py

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1974,6 +1974,32 @@ def create_sequential_pcd_task(
19741974

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

1977+
def import_appendix_file(
1978+
self,
1979+
project: str,
1980+
file_path: str,
1981+
) -> list:
1982+
"""
1983+
Import calibration file zip.
1984+
project is slug of your project (Required).
1985+
file_path is a path to data. Supported extensions are zip (Required).
1986+
"""
1987+
1988+
if not utils.is_appendix_supported_ext(file_path):
1989+
raise FastLabelInvalidException("Supported extensions are zip.", 422)
1990+
1991+
endpoint = "contents/imports/appendix/batch"
1992+
payload = {"project": project}
1993+
signed_url = self.__get_signed_path(
1994+
project=project,
1995+
file_name=os.path.basename(file_path),
1996+
file_type="application/zip",
1997+
)
1998+
self.api.upload_zipfile(url=signed_url["url"], file_path=file_path)
1999+
payload["fileKey"] = signed_url["name"]
2000+
2001+
return self.api.post_request(endpoint, payload=payload)
2002+
19772003
# Task Update
19782004

19792005
def update_task(

fastlabel/utils/__init__.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,10 @@ def is_dicom_supported_ext(file_path: str) -> bool:
4242
return file_path.lower().endswith((".zip"))
4343

4444

45+
def is_appendix_supported_ext(file_path: str) -> bool:
46+
return file_path.lower().endswith((".zip"))
47+
48+
4549
def is_pcd_supported_ext(file_path: str) -> bool:
4650
# .ply is not yet supported. To support it, modification of the API
4751
# needs to be considered as well.

0 commit comments

Comments
 (0)