config of kmeans in config file

This commit is contained in:
Askill 2020-10-18 19:24:55 +02:00
parent fe42e7b5c7
commit 947b56b7e2
4 changed files with 24 additions and 12 deletions

View File

@ -2,17 +2,19 @@
class Config:
c = {
"min_area" : 500,
"max_area" : 20000,
"threashold" : 13,
"max_area" : 40000,
"threashold" : 10,
"resizeWidth" : 512,
"inputPath" : None,
"outputPath": None,
"maxLayerLength": 900,
"minLayerLength": 20,
"tolerance": 10,
"tolerance": 20,
"maxLength": None,
"ttolerance": 10,
"videoBufferLength": 1000
"ttolerance": 60,
"videoBufferLength": 1000,
"noiseThreashold": 0.2,
"noiseSensitivity": 3/4
}
def __init__(self):

View File

@ -61,8 +61,8 @@ class Layer:
mapped = []
mapping = []
clusterCount = 1
noiseSensitivity = 3/4
noiseThreashold = 0.05
noiseSensitivity = self.config["noiseSensitivity"]
noiseThreashold = self.config["noiseThreashold"]
for i, bounds in enumerate(org):
for j, bound in enumerate(bounds):
x = (bound[0] + bound[2]/2) / self.config["w"]
@ -123,7 +123,8 @@ class Layer:
newContours[x].append(org[x][y])
self.bounds = newContours
print(f"{clusterCount} clusters identified {dists}")
#print(f"{clusterCount} clusters identified {dists}")
#fig, ax = plt.subplots()
#x=mapped[:,0]
#y=mapped[:,1]

View File

@ -40,11 +40,19 @@ class LayerFactory:
self.layers = layers
def freeData(self):
def freeMin(self):
self.data.clear()
layers = []
for l in self.layers:
if l.getLength() < self.maxLayerLength and l.getLength() > self.minLayerLength:
if l.getLength() > self.minLayerLength:
layers.append(l)
self.layers = layers
self.removeStaticLayers()
def freeMax(self):
layers = []
for l in self.layers:
if l.getLength() < self.maxLayerLength:
layers.append(l)
self.layers = layers
self.removeStaticLayers()
@ -77,10 +85,11 @@ class LayerFactory:
#pool.map_async(self.getLayers, tmp)
for x in tmp:
self.getLayers(x)
self.freeData()
self.freeMin()
self.sortLayers()
self.cleanLayers()
self.freeData()
self.freeMax()
return self.layers

Binary file not shown.