Search code examples
pythonlisttypesreturnnumpy-ndarray

What affects tensorlayer.prepro.threading_data's return type?


I've been trying to use tensorlayer.prepro.threading_data, but I'm getting a different return type for different inputs. Sometimes it returns an ndarray and sometimes it returns a list. The documentation doesn't specify what's the reason for the different return types.

Can anyone shed some light on this?

Answer: It seems that what was causing this problem was having items with different shapes in the list. In this instance, PNG images with 3 and 4 channel. Removing the alpha channel (the fourth channel) from all PNG images solved this for me.


Solution

  • It seems that what was causing this problem was having items with different shapes in the list. In this instance, PNG images with 3 and 4 channel. Removing the alpha channel (the fourth channel) from all PNG images solved this for me.