Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Train cascade classifier for game screenshots

Hello,

Sorry for my bad english :)

THE OBJECTIVE : Detect a fantasy character on a screenshot (yellow rectangle on the image) like this : https://imgur.com/GGwOrM9

THE CONTEXT :

I have screenshot extract from a video game.

All screenshot are from the "boss achievement screen". Here some screenshot negative samples :
https://imgur.com/HO9a3Ou https://imgur.com/0sScNWy https://imgur.com/v7NsStt

I need detect if a specific boss is on the screenshot. I need to detect only this boss : https://imgur.com/1WHsNTU

Important Note : it is a static screen, no movement. very little variance.

I installed opencv 2.4.13.7 successfully. I execute the 'face-detection-rectangle' example from node-opencv (https://github.com/peterbraden/node-opencv), it's ok to detect 'mona lisa' face ;)

Now I want to detect boss from screenshot. I think this is not exactly face detection but more object detection.

I do the "Cascade Classifier Training Tutorial" (https://docs.opencv.org/master/dc/d88/tutorial_traincascade.html), but...

THE PROBLEM : my training is bad, and I can't detect boss on my images. The Bad detection result : https://imgur.com/plTKl9L

QUESTIONS :

1 / I have only one positive image, I think it's ok, because it's a static screen no movement, and very simple detection needed i think ?

2 / The positive image : What is the difference between - use the complete image (like this : https://imgur.com/Fyc2bwW) and specify dimensions in info.data like this : 'positives/positive-boss-complete.jpg 1 570 193 326 265' - or crop the image (like this: https://imgur.com/1WHsNTU) and specify dimension in info.data like this : 'positives/positive-boss-crop.jpg 1 0 0 326 265'

3 / Negative images samples : What sort of image does a need ? Screenshot from other bosses ? croped screenshot or complete screenshot ? I have only 20 boss screenshot, Should i use images that have nothing to do with the game or only use game screenshots ?

4 / Create sample : I use this command 'opencv_createsamples -info info.dat -bg bg.txt -vec samples.vec -w 100 -h 100' in order to create samples. Is '-w 100 -h 100' ok for my context ? Should I use '-maxxangle' '-maxzangle' and '-maxzangle' and which values ?

5 / Train cascade : I use this command 'opencv_traincascade -w 20 -h 20 -data data -bg bg.txt -vec samples.vec -numPos 1 -numNeg 20 -numStages 10'. Have you some observations ?

Thanks for your help.