Giter VIP home page Giter VIP logo

Comments (6)

pjanx avatar pjanx commented on July 28, 2024

Your terminology is extremely confusing and alien, could you explain in simple terms?

Do you mean planar instead of interleaved?

from wuffs.

SofaScience avatar SofaScience commented on July 28, 2024

@pjanx I am sorry for that. You are right, I mean separated planes.
That's very important in many Deep Learning applications now (for example PyTorch or TensorRT use this format). However, conversation interleaved -> planar is not cheap (for example, with cv::split).

from wuffs.

pjanx avatar pjanx commented on July 28, 2024

See usages of wuffs_base__pixel_format__is_planar() and wuffs_base__pixel_buffer__plane()--no, it's not currently supported.

Your best option in the foreseeable future is to do some custom post-processing, which will also give you flexibility with the bit depth, and with the choice of channels. Understand that image formats are wild--the input may be indexed (GIF, PNG), RGB/A interleaved (PNG), or even YCbCr planar with differently sized planes (lossy formats, 4:2:2 and 4:2:0). That's a lot of paths to care about. There are bigger concerns in the image library right now.

from wuffs.

nigeltao avatar nigeltao commented on July 28, 2024

Yeah, custom post-processing is the way to go for now.

I'm surprised that HWC <-> CWH conversion isn't cheap (if HWC and CWH mean what I think it means; I've never seen those terms before today). I'm not very familiar with PyTorch or TensorRT, but it should be very SIMD friendly.

How do existing PyTorch or TensorRT programs load (and convert) PNGs? Do they use libpng? I don't see any PNG_TRANSFORM_FOOBAR definitions in libpng to split into separate R, G, B, A planes, so I'm guessing it'd have to be a post-processing step. Can you just do the same post-processing step?

from wuffs.

SofaScience avatar SofaScience commented on July 28, 2024

I'm not sure what they use, but OpenCV has optimized enough split function for cpu and cuda.
However, copy is still copy. It can be avoided in theory and on big images difference isn't small.
But thanks for answers

from wuffs.

pjanx avatar pjanx commented on July 28, 2024

For what it's worth, it's a valid request, but unlikely to be fulfilled, unless someone would step in to work on it themselves.

Another thought: if you don't control the image source, you may want to colour manage the images, which means extra processing anyway. And if you do, you may want to pre-normalize it to whatever format is seen fit.

from wuffs.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.