HumanSignal / HumanSignal/label-studio

Internal Server Error on exporting Pascal VOC format.

Open
#4,326 1 comment 0 reactions 1 assignee Claimed by @makseq View on GitHub
export problem
Dominant language
TypeScript
Stars
28.3k
Forks
3.7k
Avg merge
14h
Merged PRs (30d)
15

Description

**Describe the bug**
I have a project of 2895 images of size 1200x800, which are annotated with about 5-10 classes each on average (in total there are 30 classes). The project is linked to a Google cloud bucket where the images are stored. I tried to download both the images and the annotations in Pascal VOC XML format. When this failed, I set `download_resources=false` and a different bug occurred.

**To Reproduce**

**Bug 1: Internal Server Error**
The Python API call fails.
```
labelstudio_url = "https://label-studio-PROJECT.run.app/api/projects/ID/export?exportType=VOC&download_all_tasks=false&download_resources=true"
payload = {}
header = {
'Authorization': 'Token XXX',
'Cookie': 'XXX'
}
response = requests.request("GET", labelstudio_url, headers=headers, data=payload, timeout=3600)
```

I then went to the browser and tried it manually and got an Internal Server Error.
![Screenshot from 2023-06-06 10-44-21](https://github.com/heartexlabs/label-studio/assets/11999264/382da8af-08e5-4797-82a5-e67b856db25a)
![Screenshot from 2023-06-01 13-42-49](https://github.com/heartexlabs/label-studio/assets/11999264/a3d0b9d9-b150-4dcd-bff8-6048cf4bd006)

I concluded that probably the 2895 images were too large to zip for the Labelstudio server. So instead, I set `download_resources=false` and wanted to download the images myself from the GCP bucket.

**Bug 2: Renaming of image filenames**
I repeated the above Python API call with `download_resources=false`. This was successful in that I received the XML files with annotations. However, the filenames of the annotation XML files (and also the image filename fields inside the XML files) were changed by appending '_XXXX' at the end (some sort of hex identifier). So to be clear, both the XML file `some_image_filename_XXXX.xml`, and the field inside the XML file: `some_image_filename_XXXX.jpg` have these 4 characters appended to it.

This meant that the image filenames did not correspond with the image filenames in the bucket. So for example, a correct image filename in the bucket would be `RF937L_Cam01_09.JPG`, and then the filename returned from the Labelstudio export was `RF937L_Cam01_09_dc17.JPG`.

Even more curious, if I choose JSON export instead of Pascal VOC, this renaming does not happen, and we get the correct image filenames. So for JSON export it outputs the correct image URLs, but with VOC export it adds these hex identifiers to the filename.

**Expected behavior**
1. **Bug 1:** A ZIP file of the images and the annotations, or, if the project is too large, an error saying that there are too many images to download at once.
2. **Bug 2:** Export the annotations with the filenames corresponding to those in the linked GCP bucket, without the 4-character identifiers appended.

**Environment (please complete the following information):**
- OS: Ubuntu
- Label Studio Version 1.8.0
- Python version 3.10.6

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.