Training Wild Game Cam To Identify Deer

Hey there, I am new to all of this but I was just looking for some guidance on this. I was wanting to be able to build a camera that will utilize a motion sensor that will trigger it to take a picture of what is in front of it. This will ultimatly be a wild game camera, yes I am a hunter, and it will be taking pictures of Deer, fox, coyote, turkey, racoon, rabbit, etc.

I was wanting to train a classifier that would be able to identify these different animals. I am using some game cam pictures that I have from my actual game cams as training and testing data. Currently I am only focusing on picking out deer from pictures.

I am having quite a lot of trouble with the settings getting it to pick out the deer. I can show what I am doing below.

I have tons of pictures from my game cam. Some the deer are near and some they are far. some are full body pictures some are just headshots.

I first use the opencv_annotations command and I am drawing boxes around the whole deer in the pictures to get my positive.txt file. Some of the pictures are not the whole deer. rather the back of the deer or only the rear end. Should I just not include these pictures or should I draw a picture around those features?

Next I am using the following command to generate the vector file :

opencv_createsamples.exe -info pos.txt -w 24 -h 24 -num 1000 -vec pos.vec

Finally I am training using something like the following:

opencv_traincascade.exe -data cascade\ -vec pos.vec -bg neg.txt -w 24 -h 24 -numPos 100 -numNeg 200 -numStages 12 -maxFalseAlarmRate 0.3 -minHitRate 0.999 -precalcValBufSize 16384 -precalcldxBufSize 16384

Does anyone have an tips or tricks I can use for this?

My python code for testing is as follows:

import cv2
import os

path = "C:/Users/user/Pictures/test/"

animal_cascade=cv2.CascadeClassifier(r"Y:\Product Development\AI Game Cam\cascade.xml")

img = cv2.imread(r"C:/Users\user\Pictures\test\test.jpg")
resized = cv2.resize(400,200)
gray = cv2.cvtColor(resized, cv2.COLOR_BGR2GRAY)

animals = animal_cascade.detectMultiScale(gray,1.3,1)

for(x, y, w, h) in animals
    resized=cv2.rectangle(resized,(x,y),(x+w,y+h),(0,255,0),2)

cv2.imshow('img', resized)
cv2.waitKey(0)
cv2.destroyAllWindows()

Haar cascades are rubbish for detecting anything that is deformable. they kinda work on faces because there’s a skull. for an entire animal/human, they don’t work at all.

you’ll have to reach for deep learning.

very likely there are models that have already been trained to classify or detect your animals.

you know I was looking into Support Vector machines (SVM) and Convolutional Neural Networks (CNN) for deep learning and was about to go that route. Thanks for the reassurance that this may be the way to go.

I will keep posted on here if I find something that works best.

Thanks again.

how often does it happen, that you have more than one animal in the view ?

do you really need position detection ?

maybe you can start with training a classification (NOT a detection ml), which is far easier to achieve (image shows a deer. full stop)