CAn you tell me my mistake

Hey @vageesha,
What error are you facing while running this code?

It is saying face_section is not defined

Hey @vageesha,
This might be because you are declaring face section inside your for loop. So face section will only be declared if there are some faces detected and hence, when there are no faces detected, which means no for loop and no declaration of face selection variable then it gives error.

Yes…but prateeek bhaiya has also done the same way in the video. Can u correct my code?

hey @vageesha ,
My friend @rishabhshekhar04 has given you the reason accurately.
The reason of code working by prateek bhaiya is that , his code detected the face in one go on running , hence he didn’t received any such error , but your code , didn’t detected any face at that moment and hence couldn’t define face_section variable and hence failed and raised an error.

Its not that your code is wrong , your code is correct. Its just that , depending on input image, its reading , and your cascade , the model give outputs , this time it didn’t got any face and didn’t into the loop and hence , it just got out and raised error.

I hope this helps.
Thank You and Happy Learning :slight_smile:.

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.