Diffusion-ControlNet Bug: Incorrect Image Resizing for Non-Square Image Generation
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 13.4k
- Forks
- 2.4k
- Avg merge
- 5d 3h
- Merged PRs (30d)
- 2
Description
Description
TensorRT diffusion-controlnet bug report
Environment
TensorRT Version: 10.4 (jetpack 6.1)
NVIDIA GPU: Jetson AGX Orin
NVIDIA Driver Version:
CUDA Version:
CUDNN Version:
Steps To Reproduce
I encountered a bug while running ControlNet in the Diffusion demo. The issue does not occur when generating square images like 512x512, but it arises when generating non-square images such as 512x768.
The root cause seems to be the PIL resize function in TensorRT/demo/Diffusion/demo_controlnet.py at lines 66, 74, 78, 82, 86, 90, and 94, where the width and height are swapped. The line:
input_images.append(canny_image.resize((args.height, args.width)))
should be corrected to:
input_images.append(canny_image.resize((args.width, args.height)))
After fixing this, the issue persists, which suggests that further code modifications might be needed for image preprocessing and export handling.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with TensorRT/demo/Diffusion/demo_controlnet.py at the image-resizing lines identified in the report, and reproduce the Diffusion ControlNet demo with a 512x768 image. Verify the width and height handling, then trace the reported image preprocessing and export handling that still fails after the resize change. Done means non-square image generation works correctly without breaking square-image generation.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- computer-vision, machine-learning
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100