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()