# CascadeClassifier is empty

**URL:** https://forum.opencv.org/t/cascadeclassifier-is-empty/1087
**Category:** Python
**Created:** [January 24, 2021, 11:07am UTC](https://forum.opencv.org/t/cascadeclassifier-is-empty/1087 "2021-01-24T11:07:00Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![Abdurrahman\_Hamid](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.opencv.org/abdurrahman_hamid/32/717_2.png) [@Abdurrahman\_Hamid](https://forum.opencv.org/u/Abdurrahman_Hamid)
#### Post date: [January 24, 2021, 11:07am UTC](https://forum.opencv.org/t/cascadeclassifier-is-empty/1087/1 "2021-01-24T11:07:00Z")

</div>

![image](https://us1.discourse-cdn.com/flex020/uploads/opencv/original/1X/fa7d30127bfd6dda9f5abbca3223b7dc0f88cb26.png)  
i tried to write the path in cascadeclassifier and the haarcascade\_frontalface\_default.xml and haarcascade\_eye.xml are already in the same folder as my code. But it still shows the same error. Someone please help me

---

<div class="post-metadata">

### Author: ![crackwitz](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.opencv.org/crackwitz/32/14_2.png) [@crackwitz](https://forum.opencv.org/u/crackwitz)
#### Post date: [January 24, 2021, 11:50am UTC](https://forum.opencv.org/t/cascadeclassifier-is-empty/1087/2 "2021-01-24T11:50:12Z")

</div>

welcome.

your paths are wrong.

you need to quote the backslashes in those strings. or use r-strings, a feature of python.

please work through this introduction to python  
[https://docs.python.org/3/tutorial/introduction.html#strings](https://docs.python.org/3/tutorial/introduction.html#strings)

---

<div class="post-metadata">

### Author: ![Abdurrahman\_Hamid](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.opencv.org/abdurrahman_hamid/32/717_2.png) [@Abdurrahman\_Hamid](https://forum.opencv.org/u/Abdurrahman_Hamid)
#### Post date: [January 24, 2021, 2:03pm UTC](https://forum.opencv.org/t/cascadeclassifier-is-empty/1087/3 "2021-01-24T14:03:00Z")

</div>

it worked!! thank you man. It seems i need to learn more the basic

---

<div class="post-metadata">

### Author: ![furas](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.opencv.org/furas/32/706_2.png) [@furas](https://forum.opencv.org/u/furas)
#### Post date: [January 24, 2021, 3:39pm UTC](https://forum.opencv.org/t/cascadeclassifier-is-empty/1087/4 "2021-01-24T15:39:02Z")

</div>

Char `'\'` has special meaning in any string - even in path

ie. `'\n'` means new line, `'\t'` means tabulator, etc.

And you have `'\test'` in path so it treats `'\t'` as `tabulator`.

You may use prefix `'r'` to create `'raw'` string and then `'\'`will be treated as normal char

```auto
r"C:\Hamid\test\haarcscade_eye.xml"

```

or you have to use double `'\\'`

```auto
"C:\\Hamid\\test\\haarcscade_eye.xml"

```

or you can try to use `'/'` like in Linux

```auto
"C:/Hamid/test/haarcscade_eye.xml"

```
