Commit bfaebdb1 authored by Diego André Sant'Ana's avatar Diego André Sant'Ana 🤞
Browse files

option process or threads

parent e26eda40
...@@ -72,6 +72,8 @@ ...@@ -72,6 +72,8 @@
<option value="E501" /> <option value="E501" />
<option value="W29" /> <option value="W29" />
<option value="E501" /> <option value="E501" />
<option value="W29" />
<option value="E501" />
</list> </list>
</option> </option>
</inspection_tool> </inspection_tool>
......
...@@ -4,9 +4,8 @@ ...@@ -4,9 +4,8 @@
<list default="true" id="ff50dbe9-96fb-4654-a170-8d858ba3f6c3" name="Default Changelist" comment=""> <list default="true" id="ff50dbe9-96fb-4654-a170-8d858ba3f6c3" name="Default Changelist" comment="">
<change beforePath="$PROJECT_DIR$/.idea/inspectionProfiles/Project_Default.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/inspectionProfiles/Project_Default.xml" afterDir="false" /> <change beforePath="$PROJECT_DIR$/.idea/inspectionProfiles/Project_Default.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/inspectionProfiles/Project_Default.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" /> <change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/extraction/kcurvature.py" beforeDir="false" afterPath="$PROJECT_DIR$/src/extraction/kcurvature.py" afterDir="false" /> <change beforePath="$PROJECT_DIR$/requeriments.txt" beforeDir="false" afterPath="$PROJECT_DIR$/requeriments.txt" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/interface/tk_interface.py" beforeDir="false" afterPath="$PROJECT_DIR$/src/interface/tk_interface.py" afterDir="false" /> <change beforePath="$PROJECT_DIR$/src/extraction/feature_extraction.py" beforeDir="false" afterPath="$PROJECT_DIR$/src/extraction/feature_extraction.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/pynovisao.py" beforeDir="false" afterPath="$PROJECT_DIR$/src/pynovisao.py" afterDir="false" />
</list> </list>
<option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" /> <option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
<option name="SHOW_DIALOG" value="false" /> <option name="SHOW_DIALOG" value="false" />
...@@ -17,27 +16,30 @@ ...@@ -17,27 +16,30 @@
<component name="FileEditorManager"> <component name="FileEditorManager">
<leaf SIDE_TABS_SIZE_LIMIT_KEY="300"> <leaf SIDE_TABS_SIZE_LIMIT_KEY="300">
<file pinned="false" current-in-tab="false"> <file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/src/interface/tk_interface.py"> <entry file="file://$PROJECT_DIR$/requeriments.txt">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="15"> <state relative-caret-position="210">
<caret line="68" column="25" selection-start-line="68" selection-start-column="25" selection-end-line="68" selection-end-column="25" /> <caret line="14" column="20" selection-start-line="14" selection-start-column="20" selection-end-line="14" selection-end-column="20" />
</state> </state>
</provider> </provider>
</entry> </entry>
</file> </file>
<file pinned="false" current-in-tab="false"> <file pinned="false" current-in-tab="true">
<entry file="file://$PROJECT_DIR$/requeriments.txt"> <entry file="file://$PROJECT_DIR$/src/extraction/feature_extraction.py">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="345"> <state relative-caret-position="659">
<caret line="23" selection-start-line="23" selection-end-line="23" /> <caret line="111" column="25" lean-forward="true" selection-start-line="111" selection-start-column="25" selection-end-line="111" selection-end-column="25" />
<folding>
<element signature="e#212#221#0" expanded="true" />
</folding>
</state> </state>
</provider> </provider>
</entry> </entry>
</file> </file>
<file pinned="false" current-in-tab="true"> <file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/src/extraction/kcurvature.py"> <entry file="file://$PROJECT_DIR$/src/extraction/kcurvature.py">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="120"> <state relative-caret-position="1245">
<caret line="89" column="8" selection-start-line="89" selection-start-column="8" selection-end-line="89" selection-end-column="8" /> <caret line="89" column="8" selection-start-line="89" selection-start-column="8" selection-end-line="89" selection-end-column="8" />
<folding> <folding>
<element signature="e#172#190#0" expanded="true" /> <element signature="e#172#190#0" expanded="true" />
...@@ -123,7 +125,6 @@ ...@@ -123,7 +125,6 @@
</component> </component>
<component name="FindInProjectRecents"> <component name="FindInProjectRecents">
<findStrings> <findStrings>
<find>upd</find>
<find>parent</find> <find>parent</find>
<find>.update_idletasks()</find> <find>.update_idletasks()</find>
<find>Add</find> <find>Add</find>
...@@ -153,6 +154,7 @@ ...@@ -153,6 +154,7 @@
<find>self._image</find> <find>self._image</find>
<find>sa</find> <find>sa</find>
<find>sav</find> <find>sav</find>
<find>threads</find>
</findStrings> </findStrings>
</component> </component>
<component name="Git.Settings"> <component name="Git.Settings">
...@@ -181,7 +183,6 @@ ...@@ -181,7 +183,6 @@
<option value="$PROJECT_DIR$/src/extraction/hog.py" /> <option value="$PROJECT_DIR$/src/extraction/hog.py" />
<option value="$PROJECT_DIR$/src/extraction/lbp.py" /> <option value="$PROJECT_DIR$/src/extraction/lbp.py" />
<option value="$PROJECT_DIR$/src/extraction/gabor.py" /> <option value="$PROJECT_DIR$/src/extraction/gabor.py" />
<option value="$PROJECT_DIR$/requeriments.txt" />
<option value="$PROJECT_DIR$/src/classification/__init__.py" /> <option value="$PROJECT_DIR$/src/classification/__init__.py" />
<option value="$PROJECT_DIR$/src/util/x11_colors.py" /> <option value="$PROJECT_DIR$/src/util/x11_colors.py" />
<option value="$PROJECT_DIR$/src/interface/interface.py" /> <option value="$PROJECT_DIR$/src/interface/interface.py" />
...@@ -193,13 +194,14 @@ ...@@ -193,13 +194,14 @@
<option value="$PROJECT_DIR$/INSTALL.sh" /> <option value="$PROJECT_DIR$/INSTALL.sh" />
<option value="$PROJECT_DIR$/src/extraction/image_moments.py" /> <option value="$PROJECT_DIR$/src/extraction/image_moments.py" />
<option value="$PROJECT_DIR$/src/interface/tk/tk_canvas.py" /> <option value="$PROJECT_DIR$/src/interface/tk/tk_canvas.py" />
<option value="$PROJECT_DIR$/src/extraction/feature_extraction.py" />
<option value="$PROJECT_DIR$/src/extraction/extractor_frame_video.py" /> <option value="$PROJECT_DIR$/src/extraction/extractor_frame_video.py" />
<option value="$PROJECT_DIR$/../people-counting-opencv/pyimagesearch/centroidtracker.py" /> <option value="$PROJECT_DIR$/../people-counting-opencv/pyimagesearch/centroidtracker.py" />
<option value="$PROJECT_DIR$/../people-counting-opencv/people_counter.py" /> <option value="$PROJECT_DIR$/../people-counting-opencv/people_counter.py" />
<option value="$PROJECT_DIR$/src/pynovisao.py" /> <option value="$PROJECT_DIR$/src/pynovisao.py" />
<option value="$PROJECT_DIR$/src/interface/tk_interface.py" /> <option value="$PROJECT_DIR$/src/interface/tk_interface.py" />
<option value="$PROJECT_DIR$/src/extraction/kcurvature.py" /> <option value="$PROJECT_DIR$/src/extraction/kcurvature.py" />
<option value="$PROJECT_DIR$/requeriments.txt" />
<option value="$PROJECT_DIR$/src/extraction/feature_extraction.py" />
</list> </list>
</option> </option>
</component> </component>
...@@ -214,7 +216,6 @@ ...@@ -214,7 +216,6 @@
<foldersAlwaysOnTop value="true" /> <foldersAlwaysOnTop value="true" />
</navigator> </navigator>
<panes> <panes>
<pane id="Course" />
<pane id="ProjectPane"> <pane id="ProjectPane">
<subPane> <subPane>
<expand> <expand>
...@@ -270,6 +271,7 @@ ...@@ -270,6 +271,7 @@
<select /> <select />
</subPane> </subPane>
</pane> </pane>
<pane id="Course" />
</panes> </panes>
</component> </component>
<component name="PropertiesComponent"> <component name="PropertiesComponent">
...@@ -421,10 +423,10 @@ ...@@ -421,10 +423,10 @@
<configuration /> <configuration />
</component> </component>
<component name="ToolWindowManager"> <component name="ToolWindowManager">
<frame x="67" y="25" width="1853" height="1055" extended-state="6" /> <frame x="1024" y="-2" width="1920" height="1082" extended-state="6" />
<editor active="true" /> <editor active="true" />
<layout> <layout>
<window_info active="true" content_ui="combo" id="Project" order="0" visible="true" weight="0.3431694" /> <window_info active="true" content_ui="combo" id="Project" order="0" visible="true" weight="0.34264627" />
<window_info id="Structure" order="1" weight="0.25" /> <window_info id="Structure" order="1" weight="0.25" />
<window_info anchor="bottom" id="Message" order="0" /> <window_info anchor="bottom" id="Message" order="0" />
<window_info anchor="bottom" id="Find" order="1" weight="0.3292683" /> <window_info anchor="bottom" id="Find" order="1" weight="0.3292683" />
...@@ -519,7 +521,7 @@ ...@@ -519,7 +521,7 @@
<breakpoints> <breakpoints>
<line-breakpoint enabled="true" suspend="THREAD" type="python-line"> <line-breakpoint enabled="true" suspend="THREAD" type="python-line">
<url>file://$PROJECT_DIR$/src/extraction/feature_extraction.py</url> <url>file://$PROJECT_DIR$/src/extraction/feature_extraction.py</url>
<line>148</line> <line>157</line>
<option name="timeStamp" value="2" /> <option name="timeStamp" value="2" />
</line-breakpoint> </line-breakpoint>
<line-breakpoint enabled="true" suspend="THREAD" type="python-line"> <line-breakpoint enabled="true" suspend="THREAD" type="python-line">
...@@ -804,16 +806,6 @@ ...@@ -804,16 +806,6 @@
</state> </state>
</provider> </provider>
</entry> </entry>
<entry file="file://$PROJECT_DIR$/src/extraction/feature_extraction.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="2085">
<caret line="153" column="30" selection-start-line="153" selection-start-column="30" selection-end-line="153" selection-end-column="30" />
<folding>
<element signature="e#212#221#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/../people-counting-opencv/pyimagesearch/centroidtracker.py"> <entry file="file://$PROJECT_DIR$/../people-counting-opencv/pyimagesearch/centroidtracker.py">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="60"> <state relative-caret-position="60">
...@@ -875,6 +867,30 @@ ...@@ -875,6 +867,30 @@
</state> </state>
</provider> </provider>
</entry> </entry>
<entry file="file://$PROJECT_DIR$/src/interface/tk_interface.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="1020">
<caret line="68" column="25" selection-start-line="68" selection-start-column="25" selection-end-line="68" selection-end-column="25" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/extraction/kcurvature.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="1245">
<caret line="89" column="8" selection-start-line="89" selection-start-column="8" selection-end-line="89" selection-end-column="8" />
<folding>
<element signature="e#172#190#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/INSTALL.sh">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="135">
<caret line="9" selection-start-line="9" selection-end-line="9" selection-end-column="74" />
</state>
</provider>
</entry>
<entry file="file:///usr/local/lib/python2.7/dist-packages/matplotlib/cbook.py"> <entry file="file:///usr/local/lib/python2.7/dist-packages/matplotlib/cbook.py">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="7905"> <state relative-caret-position="7905">
...@@ -920,33 +936,19 @@ ...@@ -920,33 +936,19 @@
</state> </state>
</provider> </provider>
</entry> </entry>
<entry file="file://$PROJECT_DIR$/src/interface/tk_interface.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="15">
<caret line="68" column="25" selection-start-line="68" selection-start-column="25" selection-end-line="68" selection-end-column="25" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/INSTALL.sh">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="135">
<caret line="9" selection-start-line="9" selection-end-line="9" selection-end-column="74" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/requeriments.txt"> <entry file="file://$PROJECT_DIR$/requeriments.txt">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="345"> <state relative-caret-position="210">
<caret line="23" selection-start-line="23" selection-end-line="23" /> <caret line="14" column="20" selection-start-line="14" selection-start-column="20" selection-end-line="14" selection-end-column="20" />
</state> </state>
</provider> </provider>
</entry> </entry>
<entry file="file://$PROJECT_DIR$/src/extraction/kcurvature.py"> <entry file="file://$PROJECT_DIR$/src/extraction/feature_extraction.py">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="120"> <state relative-caret-position="659">
<caret line="89" column="8" selection-start-line="89" selection-start-column="8" selection-end-line="89" selection-end-column="8" /> <caret line="111" column="25" lean-forward="true" selection-start-line="111" selection-start-column="25" selection-end-line="111" selection-end-column="25" />
<folding> <folding>
<element signature="e#172#190#0" expanded="true" /> <element signature="e#212#221#0" expanded="true" />
</folding> </folding>
</state> </state>
</provider> </provider>
......
...@@ -12,7 +12,7 @@ python-weka-wrapper ...@@ -12,7 +12,7 @@ python-weka-wrapper
cycler==0.10 cycler==0.10
cython cython
h5py h5py
scikit-learn scikit-learn==0.20.1
statistics statistics
pandas_ml pandas_ml
pyxdg pyxdg
......
...@@ -14,6 +14,7 @@ import os ...@@ -14,6 +14,7 @@ import os
import gc import gc
import multiprocessing import multiprocessing
from multiprocessing import Process, Manager from multiprocessing import Process, Manager
import threading
from interface.interface import InterfaceException as IException from interface.interface import InterfaceException as IException
from util.file_utils import File from util.file_utils import File
...@@ -43,12 +44,20 @@ class FeatureExtractor(object): ...@@ -43,12 +44,20 @@ class FeatureExtractor(object):
self.extractors = extractors self.extractors = extractors
self.tkParent=tkParent self.tkParent=tkParent
def extract_all(self, dataset, output_file=None, dirs=None, overwrite=True): def extract_all(self, dataset, output_file=None, dirs=None, overwrite=True, processor_amd=False):
self.processor_amd=processor_amd
self.data = Manager().list() #is a necessary because have a problem with use Process and normaly declaration
self.threads = [] self.threads = []
self.labels = Manager().list() if self.processor_amd == True :
self.types = Manager().list() self.data = Manager().list() #is a necessary because have a problem with use Process and normaly declaration
self.labels = Manager().list()
self.types = Manager().list()
else:
self.data = [] #is a necessary because have a problem with use Process and normaly declaration
self.labels = []
self.types = []
"""Runs the feature extraction algorithms on all images of dataset. """Runs the feature extraction algorithms on all images of dataset.
Parameters Parameters
...@@ -98,12 +107,9 @@ class FeatureExtractor(object): ...@@ -98,12 +107,9 @@ class FeatureExtractor(object):
self.job_extractor(dataset, cl, classes) self.job_extractor(dataset, cl, classes)
self.print_console("Wait a moment, the threads are processing "+str(len(self.threads)) +" images, it may be delayed depending on the size or quantity of the images!") self.print_console("Wait a moment, the threads are processing "+str(len(self.threads)) +" images, it may be delayed depending on the size or quantity of the images!")
print("Number of Cores: "+str(multiprocessing.cpu_count()))
#Start threads
with tqdm(total=len(self.threads)) as pbar: with tqdm(total=len(self.threads)) as pbar:
for t in self.threads: for t in self.threads:
t.start() t.start()
pbar.update(1) pbar.update(1)
pbar.close() pbar.close()
...@@ -135,8 +141,11 @@ class FeatureExtractor(object): ...@@ -135,8 +141,11 @@ class FeatureExtractor(object):
for item in items : for item in items :
if item.startswith('.'): if item.startswith('.'):
continue continue
#th = threading.Thread(target=self.sub_job_extractor,args=(item, dataset, cl, classes))
th = multiprocessing.Process(target=self.sub_job_extractor,args=(item, dataset, cl, classes)) if self.processor_amd==True :
th = multiprocessing.Process(target=self.sub_job_extractor,args=(item, dataset, cl, classes))
else:
th = threading.Thread(target=self.sub_job_extractor,args=(item, dataset, cl, classes))
self.threads.append(th) self.threads.append(th)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment