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 @@
<option value="E501" />
<option value="W29" />
<option value="E501" />
<option value="W29" />
<option value="E501" />
</list>
</option>
</inspection_tool>
......
......@@ -4,9 +4,8 @@
<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/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$/src/interface/tk_interface.py" beforeDir="false" afterPath="$PROJECT_DIR$/src/interface/tk_interface.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/pynovisao.py" beforeDir="false" afterPath="$PROJECT_DIR$/src/pynovisao.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/requeriments.txt" beforeDir="false" afterPath="$PROJECT_DIR$/requeriments.txt" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/extraction/feature_extraction.py" beforeDir="false" afterPath="$PROJECT_DIR$/src/extraction/feature_extraction.py" afterDir="false" />
</list>
<option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
<option name="SHOW_DIALOG" value="false" />
......@@ -17,27 +16,30 @@
<component name="FileEditorManager">
<leaf SIDE_TABS_SIZE_LIMIT_KEY="300">
<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">
<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 relative-caret-position="210">
<caret line="14" column="20" selection-start-line="14" selection-start-column="20" selection-end-line="14" selection-end-column="20" />
</state>
</provider>
</entry>
</file>
<file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/requeriments.txt">
<file pinned="false" current-in-tab="true">
<entry file="file://$PROJECT_DIR$/src/extraction/feature_extraction.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="345">
<caret line="23" selection-start-line="23" selection-end-line="23" />
<state relative-caret-position="659">
<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>
</provider>
</entry>
</file>
<file pinned="false" current-in-tab="true">
<file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/src/extraction/kcurvature.py">
<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" />
<folding>
<element signature="e#172#190#0" expanded="true" />
......@@ -123,7 +125,6 @@
</component>
<component name="FindInProjectRecents">
<findStrings>
<find>upd</find>
<find>parent</find>
<find>.update_idletasks()</find>
<find>Add</find>
......@@ -153,6 +154,7 @@
<find>self._image</find>
<find>sa</find>
<find>sav</find>
<find>threads</find>
</findStrings>
</component>
<component name="Git.Settings">
......@@ -181,7 +183,6 @@
<option value="$PROJECT_DIR$/src/extraction/hog.py" />
<option value="$PROJECT_DIR$/src/extraction/lbp.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/util/x11_colors.py" />
<option value="$PROJECT_DIR$/src/interface/interface.py" />
......@@ -193,13 +194,14 @@
<option value="$PROJECT_DIR$/INSTALL.sh" />
<option value="$PROJECT_DIR$/src/extraction/image_moments.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$/../people-counting-opencv/pyimagesearch/centroidtracker.py" />
<option value="$PROJECT_DIR$/../people-counting-opencv/people_counter.py" />
<option value="$PROJECT_DIR$/src/pynovisao.py" />
<option value="$PROJECT_DIR$/src/interface/tk_interface.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>
</option>
</component>
......@@ -214,7 +216,6 @@
<foldersAlwaysOnTop value="true" />
</navigator>
<panes>
<pane id="Course" />
<pane id="ProjectPane">
<subPane>
<expand>
......@@ -270,6 +271,7 @@
<select />
</subPane>
</pane>
<pane id="Course" />
</panes>
</component>
<component name="PropertiesComponent">
......@@ -421,10 +423,10 @@
<configuration />
</component>
<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" />
<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 anchor="bottom" id="Message" order="0" />
<window_info anchor="bottom" id="Find" order="1" weight="0.3292683" />
......@@ -519,7 +521,7 @@
<breakpoints>
<line-breakpoint enabled="true" suspend="THREAD" type="python-line">
<url>file://$PROJECT_DIR$/src/extraction/feature_extraction.py</url>
<line>148</line>
<line>157</line>
<option name="timeStamp" value="2" />
</line-breakpoint>
<line-breakpoint enabled="true" suspend="THREAD" type="python-line">
......@@ -804,16 +806,6 @@
</state>
</provider>
</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">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="60">
......@@ -875,6 +867,30 @@
</state>
</provider>
</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">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="7905">
......@@ -920,33 +936,19 @@
</state>
</provider>
</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">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="345">
<caret line="23" selection-start-line="23" selection-end-line="23" />
<state relative-caret-position="210">
<caret line="14" column="20" selection-start-line="14" selection-start-column="20" selection-end-line="14" selection-end-column="20" />
</state>
</provider>
</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">
<state relative-caret-position="120">
<caret line="89" column="8" selection-start-line="89" selection-start-column="8" selection-end-line="89" selection-end-column="8" />
<state relative-caret-position="659">
<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#172#190#0" expanded="true" />
<element signature="e#212#221#0" expanded="true" />
</folding>
</state>
</provider>
......
......@@ -12,7 +12,7 @@ python-weka-wrapper
cycler==0.10
cython
h5py
scikit-learn
scikit-learn==0.20.1
statistics
pandas_ml
pyxdg
......
......@@ -14,6 +14,7 @@ import os
import gc
import multiprocessing
from multiprocessing import Process, Manager
import threading
from interface.interface import InterfaceException as IException
from util.file_utils import File
......@@ -43,12 +44,20 @@ class FeatureExtractor(object):
self.extractors = extractors
self.tkParent=tkParent
def extract_all(self, dataset, output_file=None, dirs=None, overwrite=True):
self.data = Manager().list() #is a necessary because have a problem with use Process and normaly declaration
def extract_all(self, dataset, output_file=None, dirs=None, overwrite=True, processor_amd=False):
self.processor_amd=processor_amd
self.threads = []
self.labels = Manager().list()
self.types = Manager().list()
if self.processor_amd == True :
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.
Parameters
......@@ -98,12 +107,9 @@ class FeatureExtractor(object):
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!")
print("Number of Cores: "+str(multiprocessing.cpu_count()))
#Start threads
with tqdm(total=len(self.threads)) as pbar:
for t in self.threads:
t.start()
pbar.update(1)
pbar.close()
......@@ -135,8 +141,11 @@ class FeatureExtractor(object):
for item in items :
if item.startswith('.'):
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)
......
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