# Revision history [back]

### Error with cv2.CascadeClassifier() using Trained Classifier

The below code runs fine when 'cascade.xml' is replaced with the 'haarcascade_frontalface_default.xml' classifier included with opencv. However, it throws this error using the cascade.xml file I created by going through the training process.

Both xml files are in the same directory in the python script, so it seems there is something wrong with my xml file. I noticed the format of the two is different, and it seems some things are missing from the end of mine. Did training not complete correctly? It went through five stages as requested with the stages parameter. Here's the xml file since I can't attach it https://pastebin.com/h0h043nR

import numpy as np
import cv2