Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

About Image Input and Output. #2213

Open
jhl13 opened this issue May 6, 2024 · 1 comment
Open

About Image Input and Output. #2213

jhl13 opened this issue May 6, 2024 · 1 comment
Labels
question Response providing clarification needed. Will not be assigned to a release. (type)

Comments

@jhl13
Copy link

jhl13 commented May 6, 2024

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 useinput = 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?

image

@jhl13 jhl13 added the question Response providing clarification needed. Will not be assigned to a release. (type) label May 6, 2024
@TobyRoseman
Copy link
Collaborator

1 - Try passing compute_precision=coremltools.precision.FLOAT16 to coremltools.convert.

2 - I don't understand the issue here. Do you want your model accept images or different sizes?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Response providing clarification needed. Will not be assigned to a release. (type)
Projects
None yet
Development

No branches or pull requests

2 participants