Ask Your Question
-1

Train cascade classifier for game screenshots

asked 2020-03-27 09:42:20 -0600

VoDHei gravatar image

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-o...), 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...), 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.

edit retag flag offensive close merge delete

Comments

my training is bad, and I can't detect boss on my images.

give up that idea, it will never work.

you cannot train anything successfully on a single positive image, your game figures contain pose variation, etc.

berak gravatar imageberak ( 2020-03-28 03:02:13 -0600 )edit

I installed opencv 2.4.13.7 successfully.

thats dead. use current 3.4 branch instead

example from node-opencv

not maintained from opencv, and we cannot help with it

berak gravatar imageberak ( 2020-03-28 05:55:31 -0600 )edit

Ok thanks, I will install 3.4.

VoDHei gravatar imageVoDHei ( 2020-03-29 11:36:46 -0600 )edit

2 answers

Sort by ยป oldest newest most voted
1

answered 2020-03-28 14:24:07 -0600

HagymaGyilkos gravatar image

What if instead of trained detection you use template matching?

Since it's static, and has very low variance, the image should look wery similar, and the position should be consistent too, so you dont't need to use the full image for matching, which can be heavy on resources, you only need an estimated ROI as a subMat. Use the image of the boss as input, and given the low variance, there should be a close match (significantly lover than other bosses) at the position of the boss.

After the template match, you look at the minimum value, and decide a minimal threshold, below you accept it as detected.

It fullifies your objective, but has zero inpact on your knowledge about Cascade Classifiers, nor answers your questions.

edit flag offensive delete link more

Comments

Yes ! I use Template matching and it's ok. Thanks

VoDHei gravatar imageVoDHei ( 2020-03-29 11:34:39 -0600 )edit
-1

answered 2020-03-29 04:56:40 -0600

ComputerVisionary gravatar image

1 Always better improving the dataset with a lot of generated samples. Otherwise you will 100% overfit the target.

2 -

3 Look at 1.

4 100 x 100 is a huge size for a cascade, main problems: noise / ram allocation. Try models up to 50x50 pixel.

5 take a look here pls: http://www.vision-ary.net/2015/03/lar...

edit flag offensive delete link more

Comments

thanks for your answer. I decide to use Template Matching more appropriate.

VoDHei gravatar imageVoDHei ( 2020-03-29 11:35:58 -0600 )edit

Question Tools

1 follower

Stats

Asked: 2020-03-27 09:42:20 -0600

Seen: 478 times

Last updated: Mar 29 '20