Reorder channel layer for smooth native RGB - BGR
See original GitHub issueThis is a commonly performed operation in image processing making it a good fit for keras-cv. While this is not a super complicated operation (it’s really just a lambda into a tf.gather) the resulting code is more readable. Let’s include this in keras-cv.
Originally discussed here: https://github.com/keras-team/keras/issues/15705
Re the design of the layer signature…
The current proposal is to implement a layer that looks like this:
rgb2bgr_layer = tf.keras.layers.ReorderChannel(order=[2, 1, 0], axis=-1)
Perhaps we actually may want to use a einsum inspired syntax, such as:
rgb2bgr_layer = tf.keras.layers.ReorderChannel('rgb->bgr', axis=-1)
This would be really readable to anyone stumbling upon a new codebase, and generalizes quite well to any number of channels.
Please feel free to comment below with any additional thoughts
Issue Analytics
- State:
- Created 2 years ago
- Reactions:1
- Comments:25 (10 by maintainers)
Top Results From Across the Web
Is there any reason for changing the channels order of an ...
Specifically, if a neural network was trained in BGR ordering, if you loaded in images in RGB format then the reversal of the...
Read more >GStreamer Plugin Details - NVIDIA Documentation Center
The low-level library (libnvds_infer) operates on any of INT8 RGB, BGR, or GRAY data with ... Specifies the data type and order for...
Read more >Basic Image Processing In Python - Part 1 | Codementor
imread loads image as RGB (or RGBA), but OpenCV assumes the image to be BGR or BGRA (BGR is the default OpenCV colour...
Read more >What is the difference between splitting an image in ... - Quora
Split : When you split an RGB (or BGR) image into its constituent channels, you get 3 images of equal size for each...
Read more >AIC - River Thames Conditions - Environment Agency - GOV.UK
Charreaux 2000, Idtv rikstv samsung, Car change of ownership form download, ... Nathan milikowsky business, Taskar eason, Solid signal tv antenna, ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I’d be fond of the API:
I think we could include this if someone wanted to contribute it.
This seems only about reordering but more in general we have many colorspace conversions in:
https://github.com/tensorflow/io/blob/v0.20.0/tensorflow_io/python/experimental/color_ops.py#L20