config of kmeans in config file
This commit is contained in:
parent
fe42e7b5c7
commit
947b56b7e2
|
|
@ -2,17 +2,19 @@
|
||||||
class Config:
|
class Config:
|
||||||
c = {
|
c = {
|
||||||
"min_area" : 500,
|
"min_area" : 500,
|
||||||
"max_area" : 20000,
|
"max_area" : 40000,
|
||||||
"threashold" : 13,
|
"threashold" : 10,
|
||||||
"resizeWidth" : 512,
|
"resizeWidth" : 512,
|
||||||
"inputPath" : None,
|
"inputPath" : None,
|
||||||
"outputPath": None,
|
"outputPath": None,
|
||||||
"maxLayerLength": 900,
|
"maxLayerLength": 900,
|
||||||
"minLayerLength": 20,
|
"minLayerLength": 20,
|
||||||
"tolerance": 10,
|
"tolerance": 20,
|
||||||
"maxLength": None,
|
"maxLength": None,
|
||||||
"ttolerance": 10,
|
"ttolerance": 60,
|
||||||
"videoBufferLength": 1000
|
"videoBufferLength": 1000,
|
||||||
|
"noiseThreashold": 0.2,
|
||||||
|
"noiseSensitivity": 3/4
|
||||||
}
|
}
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
|
|
|
||||||
|
|
@ -61,8 +61,8 @@ class Layer:
|
||||||
mapped = []
|
mapped = []
|
||||||
mapping = []
|
mapping = []
|
||||||
clusterCount = 1
|
clusterCount = 1
|
||||||
noiseSensitivity = 3/4
|
noiseSensitivity = self.config["noiseSensitivity"]
|
||||||
noiseThreashold = 0.05
|
noiseThreashold = self.config["noiseThreashold"]
|
||||||
for i, bounds in enumerate(org):
|
for i, bounds in enumerate(org):
|
||||||
for j, bound in enumerate(bounds):
|
for j, bound in enumerate(bounds):
|
||||||
x = (bound[0] + bound[2]/2) / self.config["w"]
|
x = (bound[0] + bound[2]/2) / self.config["w"]
|
||||||
|
|
@ -123,7 +123,8 @@ class Layer:
|
||||||
newContours[x].append(org[x][y])
|
newContours[x].append(org[x][y])
|
||||||
|
|
||||||
self.bounds = newContours
|
self.bounds = newContours
|
||||||
print(f"{clusterCount} clusters identified {dists}")
|
#print(f"{clusterCount} clusters identified {dists}")
|
||||||
|
|
||||||
#fig, ax = plt.subplots()
|
#fig, ax = plt.subplots()
|
||||||
#x=mapped[:,0]
|
#x=mapped[:,0]
|
||||||
#y=mapped[:,1]
|
#y=mapped[:,1]
|
||||||
|
|
|
||||||
|
|
@ -40,11 +40,19 @@ class LayerFactory:
|
||||||
self.layers = layers
|
self.layers = layers
|
||||||
|
|
||||||
|
|
||||||
def freeData(self):
|
def freeMin(self):
|
||||||
self.data.clear()
|
self.data.clear()
|
||||||
layers = []
|
layers = []
|
||||||
for l in self.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)
|
layers.append(l)
|
||||||
self.layers = layers
|
self.layers = layers
|
||||||
self.removeStaticLayers()
|
self.removeStaticLayers()
|
||||||
|
|
@ -77,10 +85,11 @@ class LayerFactory:
|
||||||
#pool.map_async(self.getLayers, tmp)
|
#pool.map_async(self.getLayers, tmp)
|
||||||
for x in tmp:
|
for x in tmp:
|
||||||
self.getLayers(x)
|
self.getLayers(x)
|
||||||
self.freeData()
|
|
||||||
|
self.freeMin()
|
||||||
self.sortLayers()
|
self.sortLayers()
|
||||||
self.cleanLayers()
|
self.cleanLayers()
|
||||||
self.freeData()
|
self.freeMax()
|
||||||
|
|
||||||
|
|
||||||
return self.layers
|
return self.layers
|
||||||
|
|
|
||||||
BIN
output/short.txt
BIN
output/short.txt
Binary file not shown.
Loading…
Reference in New Issue