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

error: OpenCV(4.9.0) D:\a\opencv-python\opencv-python\opencv\modules\dnn\src\layers\convolution_layer.cpp:396: error: (-2:Unspecified error) Number of input channels should be multiple of 3 but got 4 in function 'cv::dnn::ConvolutionLayerImpl::getMemoryShapes' #1011

Open
XZH2024 opened this issue Jul 3, 2024 · 9 comments

Comments

@XZH2024
Copy link

XZH2024 commented Jul 3, 2024

(Translated using DeepL)

Expected behaviour

Normal output.

Actual behaviour

After Auto Focus Cropping is enabled
Click the "Generate" button
error: OpenCV(4.9.0) D:\a\opencv-python\opencv-python\opencv\modules\dnn\src\layers\convolution_layer.cpp:396: error: (-2:Unspecified error) Number of input channels should be multiple of 3 but got 4 in function 'cv::dnn::ConvolutionLayerImpl::getMemoryShapes'
image

Steps to reproduce

  • Windows 10
  • x86
  • 4.9.0.80
Issue submission checklist
  • [√] This is not a generic OpenCV usage question (looking for help for coding, other usage questions, homework etc.)
  • [ √] I have read the README of this repository and understand that this repository provides only an automated build toolchain for OpenCV Python packages (there is no actual OpenCV code here)
  • [?] The issue is related to the build scripts in this repository, to the pre-built binaries or is a feature request (such as "please enable this additional dependency")
  • [×] I'm using the latest version of opencv-python
    Version 4.10.0.84 also doesn't work and doesn't report any error messages
@kevinstrax
Copy link

Use jpeg, not png

@kevinstrax
Copy link

我猜测是因为png带alpha通道(rgba),通道数是4因此报错。换成jpg就没事了。

@XZH2024
Copy link
Author

XZH2024 commented Sep 30, 2024

问题依旧存在,还是报error: OpenCV(4.9.0) D:\a\opencv-python\opencv-python\opencv\modules\dnn\src\layers\convolution_layer.cpp:396: error: (-2:Unspecified error) Number of input channels should be multiple of 3 but got 4 in function 'cv::dnn::ConvolutionLayerImpl::getMemoryShapes'错误,但是只要把“自动面部焦点剪裁”关掉就能正常出图

我猜测是因为png带alpha通道(rgba),通道数是4因此报错。换成jpg就没事了。

@puppet-king
Copy link

降级到 opencv-python==4.7.0.72, 升级到 4.10.84 不会报错但是没效果。

@kevinstrax
Copy link

问题依旧存在,还是报error: OpenCV(4.9.0) D:\a\opencv-python\opencv-python\opencv\modules\dnn\src\layers\convolution_layer.cpp:396: error: (-2:Unspecified error) Number of input channels should be multiple of 3 but got 4 in function 'cv::dnn::ConvolutionLayerImpl::getMemoryShapes'错误,但是只要把“自动面部焦点剪裁”关掉就能正常出图

我猜测是因为png带alpha通道(rgba),通道数是4因此报错。换成jpg就没事了。

我试了下,使用第一项Single Image的确不行。我是使用Batch from Directory并使用jpg可以正常使用,希望对你有帮助。
image
image
image
image

@XZH2024
Copy link
Author

XZH2024 commented Sep 30, 2024

问题依旧存在,还是报error: OpenCV(4.9.0) D:\a\opencv-python\opencv-python\opencv\modules\dnn\src\layers\convolution_layer.cpp:396: error: (-2:Unspecified error) Number of input channels should be multiple of 3 but got 4 in function 'cv::dnn::ConvolutionLayerImpl::getMemoryShapes'错误,但是只要把“自动面部焦点剪裁”关掉就能正常出图

我猜测是因为png带alpha通道(rgba),通道数是4因此报错。换成jpg就没事了。

我试了下,使用第一项Single Image的确不行。我是使用Batch from Directory并使用jpg可以正常使用,希望对你有帮助。 image image image image

在点击生成后,进度条一直显示等待中,过了几分钟之后就自动结束了,没有图片生成,输出文件夹中没有文件。也没有任何错误信息,控制台也没有日志输出😂
估计只能等作者修好绝对路径这个问题了

降级到 opencv-python==4.7.0.72, 升级到 4.10.84 不会报错但是没效果。

版本换成4.7.0.723后,依旧报错,只是报错内容中的版本号从4.9变成了4.7。。。

@kevinstrax
Copy link

问题依旧存在,还是报error: OpenCV(4.9.0) D:\a\opencv-python\opencv-python\opencv\modules\dnn\src\layers\convolution_layer.cpp:396: error: (-2:Unspecified error) Number of input channels should be multiple of 3 but got 4 in function 'cv::dnn::ConvolutionLayerImpl::getMemoryShapes'错误,但是只要把“自动面部焦点剪裁”关掉就能正常出图

我猜测是因为png带alpha通道(rgba),通道数是4因此报错。换成jpg就没事了。

我试了下,使用第一项Single Image的确不行。我是使用Batch from Directory并使用jpg可以正常使用,希望对你有帮助。 image image image image

在点击生成后,进度条一直显示等待中,过了几分钟之后就自动结束了,没有图片生成,输出文件夹中没有文件。也没有任何错误信息,控制台也没有日志输出😂 估计只能等作者修好绝对路径这个问题了

降级到 opencv-python==4.7.0.72, 升级到 4.10.84 不会报错但是没效果。

版本换成4.7.0.723后,依旧报错,只是报错内容中的版本号从4.9变成了4.7。。。

我的OpenCV版本是4.10.0

@XZH2024
Copy link
Author

XZH2024 commented Sep 30, 2024

版本升级为4.10.0.84之后还是老问题,啥都不显示就自动结束了,连日志都没有
当时是打算训练模型才打算用这个功能的,现在已经半退坑Stable-Diffusion了,暂时就这样吧......

@kevinstrax
Copy link

版本升级为4.10.0.84之后还是老问题,啥都不显示就自动结束了,连日志都没有 当时是打算训练模型才打算用这个功能的,现在已经半退坑Stable-Diffusion了,暂时就这样吧......

我中秋刚接触,那时候训练的,的确也就那样。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants