About Image Input and Output.
- Dominant language
- Python
- Stars
- 5.4k
- Forks
- 850
- Avg merge
- 4d 5h
- Merged PRs (30d)
- 10
Description
I have a few questions and concerns. I have a denoising model where I preprocess the input by dividing it by 255 and postprocess the output by multiplying it by 255. However, when I use image input and output, I encounter the following issues:
1. When I use`input = ct.ImageType(name='input', shape=(1, 3, 1080, 1920), color_layout=ct.colorlayout.RGB, scale=1/255.)` as the input conversion for the model, it inserts a `mul` node, but this node performs calculations in fp32 which is very slow. Is there a way to force the scale node to use fp16 calculations? Additionally, because subsequent convolution operations default to using fp16, it further increases the need to add a `cast` operator to convert the fp32 output of the `mul` operator to fp16 output.
2. `output = ct.ImageType(name='output', color_layout=ct.colorlayout.RGB)`, the scale must be set to 1.0, which is very inconvenient to use and requires additional post-processing.
Is there a way to solve these issues?

Contributor guide
Research direction
Start with the ct.ImageType input and output conversion behavior described in the issue, focusing on the generated mul and cast operations and their precision. Done means determining whether input scaling can use fp16 without an unnecessary cast and whether output scaling can avoid the requested post-processing; document any limitations if not.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- machine-learning
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100