it's running now
This commit is contained in:
parent
8aa8cd1aae
commit
cb4b02f987
|
|
@ -1,7 +1,7 @@
|
|||
|
||||
class Config:
|
||||
c = {
|
||||
"min_area" : 5000,
|
||||
"min_area" : 10,
|
||||
"max_area" : 40000,
|
||||
"threashold" : 7,
|
||||
"resizeWidth" : 512,
|
||||
|
|
|
|||
|
|
@ -55,21 +55,27 @@ class ContourExtractor:
|
|||
threads = self.config["videoBufferLength"]
|
||||
self.start = time.time()
|
||||
# start a bunch of frames and let them read from the video reader buffer until the video reader reaches EOF
|
||||
with ThreadPool(self.config["ce_comp_threads"]) as pool:
|
||||
with ThreadPool(2) as pool:
|
||||
while not videoReader.videoEnded():
|
||||
if videoReader.buffer.qsize() <= 5:
|
||||
time.sleep(.5)
|
||||
|
||||
tmpData = [videoReader.pop() for i in range(0, videoReader.buffer.qsize())]
|
||||
self.computeMovingAverage(tmpData)
|
||||
pool.map(self.getContours, tmpData)
|
||||
pool.map(self.computeMovingAverage, (tmpData,))
|
||||
pool.map(self.async2, (tmpData,))
|
||||
|
||||
#for data in tmpData:
|
||||
# self.getContours(data)
|
||||
frameCount = tmpData[-1][0]
|
||||
|
||||
videoReader.thread.join()
|
||||
return self.extractedContours, self.extractedMasks
|
||||
|
||||
|
||||
def async2(self, tmpData):
|
||||
with ThreadPool(self.config["ce_comp_threads"]) as pool2:
|
||||
pool2.map(self.getContours, tmpData)
|
||||
|
||||
|
||||
def getContours(self, data):
|
||||
frameCount, frame = data
|
||||
# wait for the reference frame, which is calculated by averaging some revious frames
|
||||
|
|
|
|||
8
bm.csv
8
bm.csv
|
|
@ -1,3 +1,5 @@
|
|||
ce_average_threads,ce_comp_threads,lf_threads,videoBufferLength,ce,le,lm,ex
|
||||
16,16,16,500,0,3.691664457321167,3.737372398376465,0.008670568466186523,3.7460429668426514
|
||||
|
||||
ce_average_threads,ce_comp_threads,lf_threads,videoBufferLength,ce,le,lm,ex
|
||||
1,1,16,500,467.52107214927673,1.9164767265319824,0.018573522567749023,49.83112931251526,519.2878699302673
|
||||
|
||||
1,3,16,500,459.9842381477356,1.716508150100708,0.018574953079223633,48.010451316833496,509.729772567749
|
||||
1,5,16,500,446.62813115119934,1.8129642009735107,0.018575429916381836,47.728522539138794,496.188193321228
|
||||
|
|
|
|||
|
27
main.py
27
main.py
|
|
@ -61,11 +61,10 @@ def main(v1, v2, v3, v4):
|
|||
#layerManager.tagLayers()
|
||||
layers = layerManager.layers
|
||||
#print([len(l) for l in sorted(layers, key = lambda c:len(c), reverse=True)[:20]])
|
||||
if len(layers) == 0:
|
||||
exit(1)
|
||||
|
||||
exporter = Exporter(config)
|
||||
#print(f"Exporting {len(contours)} Contours and {len(layers)} Layers")
|
||||
#exporter.export(layers, contours, masks, raw=False, overlayed=True)
|
||||
exporter.export(layers, contours, masks, raw=False, overlayed=True)
|
||||
stats.append(time.time() - start)
|
||||
|
||||
print("Total time: ", time.time() - startTotal)
|
||||
|
|
@ -75,13 +74,25 @@ def main(v1, v2, v3, v4):
|
|||
writer = csv.writer(myfile)
|
||||
writer.writerow(stats)
|
||||
#print(stats)
|
||||
exit(0)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
ass = list(range(4, 18, 4))
|
||||
bss = list(range(4, 18, 4))
|
||||
css = list(range(1, 16, 8))
|
||||
dss = list(range(100, 500, 200))
|
||||
ass = list(range(1, 16, 2))
|
||||
bss = list(range(1, 16, 2))
|
||||
css = [16]
|
||||
dss = [500]
|
||||
params = [ass, bss, css, dss]
|
||||
params = list(product(*params))
|
||||
counter = 0
|
||||
for a,b,c,d in params:
|
||||
print(f"{counter}/{len(params)} - {counter/len(params)} {a, b, c, d}")
|
||||
counter += 1
|
||||
main(a, b, c, d)
|
||||
|
||||
ass = [16]
|
||||
bss = [16]
|
||||
css = list(range(1, 16, 4))
|
||||
dss = list(range(50, 500, 200))
|
||||
params = [ass, bss, css, dss]
|
||||
params = list(product(*params))
|
||||
counter = 0
|
||||
|
|
|
|||
Loading…
Reference in New Issue