# Python YUNet workflow

**URL:** <https://forum.opencv.org/t/python-yunet-workflow/20942>\
**Category:** Python\
**Tags:** dnn, facedetection\
**Created:** [May 3, 2025, 6:47am UTC](https://forum.opencv.org/t/python-yunet-workflow/20942 "2025-05-03T06:47:14Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![TypeVar](https://avatars.discourse-cdn.com/v4/letter/t/a88e4f/32.png) [@TypeVar](https://forum.opencv.org/u/TypeVar)\
**Post date:** [May 3, 2025, 6:47am UTC](https://forum.opencv.org/t/python-yunet-workflow/20942/1 "2025-05-03T06:47:14Z")

</div>

Hi there.

I’m enjoying YUNet face detector from here: [opencv\_zoo/models/face\_detection\_yunet at main · opencv/opencv\_zoo · GitHub](https://github.com/opencv/opencv_zoo/tree/main/models/face_detection_yunet)

I noticed that raw `.onnx` file has input shape of `640x640`, but in `demo.py` the input shape was set to `320x320`. Moreover in `demo.py` in line `98` input size is reset to the frame size. I’m struggling to understand on what actual image size the inference goes on.

I tried to read C++ code from here: [opencv/modules/objdetect/src/face\_detect.cpp at 4.x · opencv/opencv · GitHub](https://github.com/opencv/opencv/blob/4.x/modules/objdetect/src/face_detect.cpp)  
but to my shame it’s quite difficult for me to understand preprocessing and postprocessing steps.

Could you please clarify for me what’s going on during YUNet inference? What are preprocessing/postprocessing steps?

Thank you so much!
