Home > other >  Opencv classifier test, no error, but has been run out
Opencv classifier test, no error, but has been run out

Time:10-07

Source program is:

The import cv2 as CV

Face_detect_file='E:/TensorFlow_gpu/Release/data/cascade. The XML' # cascade classifier XML file address
File_name='E:/TensorFlow_gpu/Release/verify/1. JPG'


Face_cascade=CV. CascadeClassifie (face_detect_file) # initialization detector
Img=CV. Imread (file_name)

Gray=CV. CvtColor (img, CV. COLOR_BGR2GRAY)
Faces=face_cascade. DetectMultiScale (gray, 1.3, 2) # [[161, 71, 122, 122]]
Print (' num of face: 'len (faces))

# draw rectangle
For (x, y, w, h) in faces:
CV. A rectangle (img, (x, y), (y + x + w, h), (0,0,255), 2)
CV. Imshow (" result ", img)

CV. WaitKey (0)
CV. DestroyAllWindows ()

1, run: face_cascade=CV. CascadeClassifie (face_detect_file) # initialization detector
Face_cascade, there is no return value

2, run: faces=face_cascade detectMultiScale (gray, 1.3, 2) # [[161, 71, 122, 122]]
Has been run out

No error,


The XML file contents as follows:
<? The XML version="1.0"?>

BOOST
LBP
20 & lt;/height>
20 & lt;/width>

GAB
9.9500000476837158 e-001 & lt;/minHitRate>
5.0000000000000000 e-001 & lt;/maxFalseAlarm>
9.4999999999999996 e-001 & lt;/weightTrimRate>
1 & lt;/maxDepth>
100 & lt;/maxWeakCount>


256 & lt;/maxCatCount>
1 & lt;/featSize>

3 & lt;/stageNum>

<_ & gt;
2 & lt;/maxWeakCount>
1.5919847786426544 e-001 & lt;/stageThreshold>

<_ & gt;

1 0 and 1, 154243344-1031798784, 65544, 1091044368, 4266
- 1261961086 42118-1904072693 & lt;/internalNodes>

6.8750000000000000-8.0851066112518311 e-001 e-001 & lt;/leafValues> <_ & gt;

3 0-1-536936448, 16810377-1073676029, 226258928-1987534848
1015021569-2142764886, 1887608960 & lt;/internalNodes>

7.7381283044815063-8.4669846296310425 e-001 e-001 & lt;/leafValues> <_ & gt;
2 & lt;/maxWeakCount>
7.4633985757827759 e-002 & lt;/stageThreshold>

<_ & gt;

0 and 1, 4, 1610498014-1342177281, 2147483387, 266338175
2097118527, 931135223, 41974783-1937244013 & lt;/internalNodes>

9.2405062913894653-7.4774771928787231 e-001 e-001 & lt;/leafValues> <_ & gt;

2 0 and 1, 25198627, 1342177288, 16778264-1006567422-2130444264
1091043336 167805083 270565378 & lt;/internalNodes>

8.4349775314331055-8.4941667318344116 e-001 e-001 & lt;/leafValues> <_ & gt;
1 & lt;/maxWeakCount>
1. & lt;/stageThreshold>

<_ & gt;

1 0 0-524288, 64, 256, 32769, 33280, 98316 & lt;/internalNodes>

1. 1. & lt;/leafValues>

<_ & gt;

4 1 2 & lt;/rect> <_ & gt;

2 9 1 1 & lt;/rect> <_ & gt;

5 3 2 & lt;/rect> <_ & gt;

6 November 1 1 & lt;/rect> <_ & gt;

15 3 1 1 & lt;/rect>

  • Related