ignoring the giraffe

This commit is contained in:
Askill 2020-11-01 21:50:24 +01:00
parent c79cc2a62c
commit 82e708ff94
2 changed files with 27 additions and 8 deletions

View File

@ -7,6 +7,7 @@ import tensorflow as tf
import cv2 import cv2
import os import os
import json import json
import imutils
from Application.Classifiers.ClassifierInterface import ClassifierInterface from Application.Classifiers.ClassifierInterface import ClassifierInterface
@ -32,20 +33,36 @@ class Classifier(ClassifierInterface):
#print(self.classes[classes[i]]) #print(self.classes[classes[i]])
return self.classes[classes[i]] return self.classes[classes[i]]
def tagLayer(self, data): def tagLayer(self, data):
res = [] res = []
for cnts in data: for cnts in data:
for cnt in cnts: for cnt in cnts:
if cnt.any(): if cnt.any():
cnt= imutils.resize(cnt, width=320)
x = self.detect(cnt) x = self.detect(cnt)
if x not in res:
res.append(x) res.append(x)
if x is not None:
print(x) di = dict()
cv2.imshow("changes x", cnt) for re in res:
cv2.waitKey(10) & 0XFF if re not in di:
return res di[re] = 0
di[re]+=1
# remove all tags that occour infrequently
# if a giraff is only seen in 2 out of 100 frames, there probably wasn't a giraff in the layer
#
di.pop(None, None)
total = 0
for value in di.values():
total += value
result = []
for key, value in di.items():
if value > len(data) / len(di) / 2:
result.append(key)
return result
# Detector API can be changed out given the I/O remains the same # Detector API can be changed out given the I/O remains the same
# this way you can use a different N-Net if you like to # this way you can use a different N-Net if you like to

View File

@ -6,3 +6,5 @@ Time consumed reading video: 240.s 3.06GB 26min 1080p downscaled 500p 30fps
contour extraction: 10.5 Sec. when only 2 Threads contour extraction: 10.5 Sec. when only 2 Threads
8 secs when also mapping getContours() 8 secs when also mapping getContours()
install tensorflow==1.15.0 and tensorflow-gpu==1.15.0, cuda 10.2 and 10.0, copy missing files from 10.0 to 10.2, restart computer, set maximum vram