roboflow / roboflow-python

The official Roboflow Python package. Manage your datasets, models, and deployments. Roboflow has everything you need to build a computer vision application.
https://docs.roboflow.com/python
Apache License 2.0
292 stars 74 forks source link

Transparency (alpha) band of PNG images not used when training #112

Open fferlito opened 1 year ago

fferlito commented 1 year ago

A normal image is composed by red, green, and blue (RGB) channels. Some image format, like .png, allow to have 4, where the 4th usually it's the transparency of the image (this is called alpha channel sometimes). In most of our dataset, we exploit this extra channel to put an extra color information, the infrared band (since we use satellite images with 4 bands). When we upload PNG images with 4 bands, and then we download it back from roboflow, this information is lost, as the downloaded images have in the alpha band only 255 as value, and also the RGB values seems slightly modified.

I'm attaching to this email a link to a COCO dataset that can be uploaded to debug this problem: here

FrancescoSaverioZuppichini commented 1 year ago

Hi @fferlito 👋

Thanks for opening an issue, unfortunately we don't currently allow custom formats (in your case, this is a custom format since the forth channel doesn't hold the transparency information). I do believe we drop it at some point. Moreover, I also believe YOLO uses 3 channels, not more.

cc @Jacobsolawetz

fferlito commented 1 year ago

Hi,

thanks the reply. The format itself is not custom, but it's PNG. I thought it would be a bug since the RGB values are modified when there any information in the alpha channel, and I guess this is not generally desirable.

For YOLO, yes, that's not a problem, but it is when using any other model which can make use of extra color bands. This feature will make the life of me and my team a lot easier, as now we need to keep a copy of the dataset locally to use it for local training. I hope it will be added at some point :smiley:

FrancescoSaverioZuppichini commented 1 year ago

Thank you very much for taking the time to respond. It seems that the information being added to the transparency channel may not actually be transparency, thus it's not really a PNG - strictly speaking.

However, I understand that this may not be the main issue at hand. As far as I am aware, YOLO doesn't currently use the fourth channel, so there may be limited options available to address this matter. I would like to suggest that we consider opening an issue with YOLO (either version 5 or 8) to inquire about the possibility of a solution.

Thank you again for your response :)