Commit 8a92775d authored by 武继龙's avatar 武继龙

modify input

parent e2f9c348
No preview for this file type
...@@ -3,7 +3,8 @@ ...@@ -3,7 +3,8 @@
<component name="ChangeListManager"> <component name="ChangeListManager">
<list default="true" id="c99523d9-010f-4b7a-8f3f-0e626959dd1a" name="Default Changelist" comment=""> <list default="true" id="c99523d9-010f-4b7a-8f3f-0e626959dd1a" name="Default Changelist" comment="">
<change beforePath="$PROJECT_DIR$/onnx_infer/main.py" beforeDir="false" afterPath="$PROJECT_DIR$/onnx_infer/main.py" afterDir="false" /> <change beforePath="$PROJECT_DIR$/onnx_infer/main.py" beforeDir="false" afterPath="$PROJECT_DIR$/onnx_infer/main.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/onnx_infer/supression.py" beforeDir="false" afterPath="$PROJECT_DIR$/onnx_infer/supression.py" afterDir="false" /> <change beforePath="$PROJECT_DIR$/onnx_infer/yolodata.py" beforeDir="false" afterPath="$PROJECT_DIR$/onnx_infer/yolodata.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/setup.py" beforeDir="false" afterPath="$PROJECT_DIR$/setup.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" />
...@@ -12,12 +13,12 @@ ...@@ -12,12 +13,12 @@
<option name="LAST_RESOLUTION" value="IGNORE" /> <option name="LAST_RESOLUTION" value="IGNORE" />
</component> </component>
<component name="FileEditorManager"> <component name="FileEditorManager">
<leaf> <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$/onnx_infer/supression.py"> <entry file="file://$PROJECT_DIR$/onnx_infer/supression.py">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="119"> <state relative-caret-position="361">
<caret line="22" lean-forward="true" selection-start-line="22" selection-end-line="22" /> <caret line="22" selection-start-line="22" selection-end-line="22" />
<folding> <folding>
<element signature="e#0#18#0" expanded="true" /> <element signature="e#0#18#0" expanded="true" />
</folding> </folding>
...@@ -28,7 +29,8 @@ ...@@ -28,7 +29,8 @@
<file pinned="false" current-in-tab="false"> <file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/onnx_infer/yolodata.py"> <entry file="file://$PROJECT_DIR$/onnx_infer/yolodata.py">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state> <state relative-caret-position="456">
<caret line="24" column="24" lean-forward="true" selection-start-line="24" selection-start-column="24" selection-end-line="24" selection-end-column="24" />
<folding> <folding>
<element signature="e#0#21#0" expanded="true" /> <element signature="e#0#21#0" expanded="true" />
</folding> </folding>
...@@ -39,7 +41,7 @@ ...@@ -39,7 +41,7 @@
<file pinned="false" current-in-tab="false"> <file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/onnx_infer/yolo3/model.py"> <entry file="file://$PROJECT_DIR$/onnx_infer/yolo3/model.py">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="203"> <state relative-caret-position="2926">
<caret line="165" selection-start-line="165" selection-end-line="165" /> <caret line="165" selection-start-line="165" selection-end-line="165" />
<folding> <folding>
<element signature="e#0#27#0" expanded="true" /> <element signature="e#0#27#0" expanded="true" />
...@@ -50,9 +52,7 @@ ...@@ -50,9 +52,7 @@
</file> </file>
<file pinned="false" current-in-tab="false"> <file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/onnx_infer/yolo3/utils.py"> <entry file="file://$PROJECT_DIR$/onnx_infer/yolo3/utils.py">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor" />
<state relative-caret-position="-208" />
</provider>
</entry> </entry>
</file> </file>
<file pinned="false" current-in-tab="false"> <file pinned="false" current-in-tab="false">
...@@ -63,7 +63,7 @@ ...@@ -63,7 +63,7 @@
<file pinned="false" current-in-tab="false"> <file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/onnx_infer/color.py"> <entry file="file://$PROJECT_DIR$/onnx_infer/color.py">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="-531"> <state>
<folding> <folding>
<element signature="e#0#32#0" expanded="true" /> <element signature="e#0#32#0" expanded="true" />
</folding> </folding>
...@@ -84,10 +84,10 @@ ...@@ -84,10 +84,10 @@
<file pinned="false" current-in-tab="true"> <file pinned="false" current-in-tab="true">
<entry file="file://$PROJECT_DIR$/onnx_infer/main.py"> <entry file="file://$PROJECT_DIR$/onnx_infer/main.py">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="282"> <state relative-caret-position="187">
<caret line="62" lean-forward="true" selection-start-line="62" selection-end-line="62" /> <caret line="61" column="32" lean-forward="true" selection-start-line="61" selection-start-column="32" selection-end-line="61" selection-end-column="32" />
<folding> <folding>
<element signature="e#419#475#0" expanded="true" /> <element signature="e#419#484#0" expanded="true" />
</folding> </folding>
</state> </state>
</provider> </provider>
...@@ -112,14 +112,15 @@ ...@@ -112,14 +112,15 @@
<component name="IdeDocumentHistory"> <component name="IdeDocumentHistory">
<option name="CHANGED_PATHS"> <option name="CHANGED_PATHS">
<list> <list>
<option value="$PROJECT_DIR$/onnx_infer/main.py" />
<option value="$PROJECT_DIR$/onnx_infer/supression.py" /> <option value="$PROJECT_DIR$/onnx_infer/supression.py" />
<option value="$PROJECT_DIR$/onnx_infer/yolodata.py" />
<option value="$PROJECT_DIR$/onnx_infer/main.py" />
</list> </list>
</option> </option>
</component> </component>
<component name="ProjectFrameBounds"> <component name="ProjectFrameBounds">
<option name="x" value="40" /> <option name="x" value="40" />
<option name="y" value="111" /> <option name="y" value="31" />
<option name="width" value="1400" /> <option name="width" value="1400" />
<option name="height" value="815" /> <option name="height" value="815" />
</component> </component>
...@@ -140,12 +141,6 @@ ...@@ -140,12 +141,6 @@
<item name="onnx" type="462c0819:PsiDirectoryNode" /> <item name="onnx" type="462c0819:PsiDirectoryNode" />
<item name="onnx_infer" type="462c0819:PsiDirectoryNode" /> <item name="onnx_infer" type="462c0819:PsiDirectoryNode" />
</path> </path>
<path>
<item name="onnx" type="b2602c69:ProjectViewProjectNode" />
<item name="onnx" type="462c0819:PsiDirectoryNode" />
<item name="onnx_infer" type="462c0819:PsiDirectoryNode" />
<item name="model_data" type="462c0819:PsiDirectoryNode" />
</path>
<path> <path>
<item name="onnx" type="b2602c69:ProjectViewProjectNode" /> <item name="onnx" type="b2602c69:ProjectViewProjectNode" />
<item name="onnx" type="462c0819:PsiDirectoryNode" /> <item name="onnx" type="462c0819:PsiDirectoryNode" />
...@@ -160,6 +155,7 @@ ...@@ -160,6 +155,7 @@
</panes> </panes>
</component> </component>
<component name="PropertiesComponent"> <component name="PropertiesComponent">
<property name="SHARE_PROJECT_CONFIGURATION_FILES" value="true" />
<property name="WebServerToolWindowFactoryState" value="false" /> <property name="WebServerToolWindowFactoryState" value="false" />
<property name="node.js.detected.package.eslint" value="true" /> <property name="node.js.detected.package.eslint" value="true" />
<property name="node.js.detected.package.tslint" value="true" /> <property name="node.js.detected.package.tslint" value="true" />
...@@ -246,22 +242,23 @@ ...@@ -246,22 +242,23 @@
<updated>1563429063264</updated> <updated>1563429063264</updated>
<workItem from="1563429064722" duration="31000" /> <workItem from="1563429064722" duration="31000" />
<workItem from="1563429380140" duration="1971000" /> <workItem from="1563429380140" duration="1971000" />
<workItem from="1563440209053" duration="966000" />
</task> </task>
<servers /> <servers />
</component> </component>
<component name="TimeTrackingManager"> <component name="TimeTrackingManager">
<option name="totallyTimeSpent" value="2002000" /> <option name="totallyTimeSpent" value="2968000" />
</component> </component>
<component name="ToolWindowManager"> <component name="ToolWindowManager">
<frame x="40" y="111" width="1400" height="815" extended-state="0" /> <frame x="40" y="31" width="1400" height="815" extended-state="0" />
<editor active="true" /> <editor active="true" />
<layout> <layout>
<window_info content_ui="combo" id="Project" order="0" visible="true" weight="0.2533137" /> <window_info content_ui="combo" id="Project" order="0" visible="true" weight="0.2569956" />
<window_info id="Structure" order="1" side_tool="true" weight="0.25" /> <window_info id="Structure" order="1" side_tool="true" weight="0.25" />
<window_info id="Favorites" order="2" side_tool="true" /> <window_info id="Favorites" order="2" side_tool="true" />
<window_info anchor="bottom" id="Message" order="0" /> <window_info anchor="bottom" id="Message" order="0" />
<window_info anchor="bottom" id="Find" order="1" /> <window_info anchor="bottom" id="Find" order="1" />
<window_info anchor="bottom" id="Run" order="2" weight="0.5504841" /> <window_info anchor="bottom" id="Run" order="2" weight="0.34024897" />
<window_info anchor="bottom" id="Debug" order="3" weight="0.4" /> <window_info anchor="bottom" id="Debug" order="3" weight="0.4" />
<window_info anchor="bottom" id="Cvs" order="4" weight="0.25" /> <window_info anchor="bottom" id="Cvs" order="4" weight="0.25" />
<window_info anchor="bottom" id="Inspection" order="5" weight="0.4" /> <window_info anchor="bottom" id="Inspection" order="5" weight="0.4" />
...@@ -284,23 +281,39 @@ ...@@ -284,23 +281,39 @@
</component> </component>
<component name="com.intellij.coverage.CoverageDataManagerImpl"> <component name="com.intellij.coverage.CoverageDataManagerImpl">
<SUITE FILE_PATH="coverage/onnx$supression.coverage" NAME="supression Coverage Results" MODIFIED="1563430968413" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="true" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$/onnx_infer" /> <SUITE FILE_PATH="coverage/onnx$supression.coverage" NAME="supression Coverage Results" MODIFIED="1563430968413" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="true" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$/onnx_infer" />
<SUITE FILE_PATH="coverage/onnx$main.coverage" NAME="main Coverage Results" MODIFIED="1563430973365" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="true" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$/onnx_infer" /> <SUITE FILE_PATH="coverage/onnx$main.coverage" NAME="main Coverage Results" MODIFIED="1563441173080" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="true" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$/onnx_infer" />
</component> </component>
<component name="editorHistoryManager"> <component name="editorHistoryManager">
<entry file="file://$PROJECT_DIR$/onnx_infer/model_data/yolo_anchors.txt"> <entry file="file://$PROJECT_DIR$/onnx_infer/model_data/yolo_anchors.txt" />
<provider selected="true" editor-type-id="text-editor" /> <entry file="file://$PROJECT_DIR$/onnx_infer/supression.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="361">
<caret line="22" selection-start-line="22" selection-end-line="22" />
<folding>
<element signature="e#0#18#0" expanded="true" />
</folding>
</state>
</provider>
</entry> </entry>
<entry file="file://$PROJECT_DIR$/onnx_infer/yolo3/utils.py"> <entry file="file://$PROJECT_DIR$/onnx_infer/yolo3/model.py">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="-208" /> <state relative-caret-position="2926">
<caret line="165" selection-start-line="165" selection-end-line="165" />
<folding>
<element signature="e#0#27#0" expanded="true" />
</folding>
</state>
</provider> </provider>
</entry> </entry>
<entry file="file://$PROJECT_DIR$/onnx_infer/yolo3/utils.py">
<provider selected="true" editor-type-id="text-editor" />
</entry>
<entry file="file://$PROJECT_DIR$/onnx_infer/__init__.py"> <entry file="file://$PROJECT_DIR$/onnx_infer/__init__.py">
<provider selected="true" editor-type-id="text-editor" /> <provider selected="true" editor-type-id="text-editor" />
</entry> </entry>
<entry file="file://$PROJECT_DIR$/onnx_infer/color.py"> <entry file="file://$PROJECT_DIR$/onnx_infer/color.py">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="-531"> <state>
<folding> <folding>
<element signature="e#0#32#0" expanded="true" /> <element signature="e#0#32#0" expanded="true" />
</folding> </folding>
...@@ -324,39 +337,20 @@ ...@@ -324,39 +337,20 @@
</entry> </entry>
<entry file="file://$PROJECT_DIR$/onnx_infer/yolodata.py"> <entry file="file://$PROJECT_DIR$/onnx_infer/yolodata.py">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state> <state relative-caret-position="456">
<caret line="24" column="24" lean-forward="true" selection-start-line="24" selection-start-column="24" selection-end-line="24" selection-end-column="24" />
<folding> <folding>
<element signature="e#0#21#0" expanded="true" /> <element signature="e#0#21#0" expanded="true" />
</folding> </folding>
</state> </state>
</provider> </provider>
</entry> </entry>
<entry file="file://$PROJECT_DIR$/onnx_infer/yolo3/model.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="203">
<caret line="165" selection-start-line="165" selection-end-line="165" />
<folding>
<element signature="e#0#27#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/onnx_infer/supression.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="119">
<caret line="22" lean-forward="true" selection-start-line="22" selection-end-line="22" />
<folding>
<element signature="e#0#18#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/onnx_infer/main.py"> <entry file="file://$PROJECT_DIR$/onnx_infer/main.py">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="282"> <state relative-caret-position="187">
<caret line="62" lean-forward="true" selection-start-line="62" selection-end-line="62" /> <caret line="61" column="32" lean-forward="true" selection-start-line="61" selection-start-column="32" selection-end-line="61" selection-end-column="32" />
<folding> <folding>
<element signature="e#419#475#0" expanded="true" /> <element signature="e#419#484#0" expanded="true" />
</folding> </folding>
</state> </state>
</provider> </provider>
......
No preview for this file type
...@@ -8,22 +8,22 @@ the result of this is the category and bounding box which is the max score. ...@@ -8,22 +8,22 @@ the result of this is the category and bounding box which is the max score.
""" """
#******************* #*******************
from yolodata import path2Img, letterbox_image, path2arr from yolodata import path2Img, letterbox_image, path2arr, arr2Img
from onnx2kera import onnxinfere from onnx2kera import onnxinfere
from supression import Supress from supression import Supress
import tensorflow as tf import tensorflow as tf
from color import COLORS, featureTransform, resize, get_color from color import COLORS, featureTransform, resize, get_color
from croppic import cropImage from croppic import cropImage
import cv2
#global #global
categorys = ['long sleeve dress', 'vest dress', 'vest', 'long sleeve outwear', 'long sleeve top', categorys = ['long sleeve dress', 'vest dress', 'vest', 'long sleeve outwear', 'long sleeve top',
'trousers', 'short sleeve top', 'sling dress', 'skirt', 'short sleeve dress', 'shorts'] 'trousers', 'short sleeve top', 'sling dress', 'skirt', 'short sleeve dress', 'shorts']
class Main: class Main:
def __init__(self, colorOnnx_path, yoloOnnx_path, image_path): def __init__(self, colorOnnx_path, yoloOnnx_path, image_arr):
self.colorOnnx_path = colorOnnx_path self.colorOnnx_path = colorOnnx_path
self.yoloOnnx_path = yoloOnnx_path self.yoloOnnx_path = yoloOnnx_path
self.image_path = image_path self.image_arr = image_arr
self.score = 0.05 self.score = 0.05
self.iou = 0.05 self.iou = 0.05
self.picSize = (416, 416) self.picSize = (416, 416)
...@@ -32,7 +32,7 @@ class Main: ...@@ -32,7 +32,7 @@ class Main:
def bboxAndcategory(self): def bboxAndcategory(self):
bbox = [] bbox = []
category = [] category = []
image = path2Img(self.image_path) image = arr2Img(self.image_arr)
image_data = letterbox_image(image, self.picSize) image_data = letterbox_image(image, self.picSize)
precit = onnxinfere(self.yoloOnnx_path, image_data) precit = onnxinfere(self.yoloOnnx_path, image_data)
feature = [] feature = []
...@@ -47,7 +47,7 @@ class Main: ...@@ -47,7 +47,7 @@ class Main:
def colorAndbboxAndcategory(self): def colorAndbboxAndcategory(self):
bbox, category = self.bboxAndcategory() bbox, category = self.bboxAndcategory()
image_arr = path2arr(self.image_path) image_arr = self.image_arr
image_crop = cropImage(image_arr, bbox) image_crop = cropImage(image_arr, bbox)
resized = resize(image_crop) resized = resize(image_crop)
tmp = featureTransform(resized) tmp = featureTransform(resized)
...@@ -56,8 +56,8 @@ class Main: ...@@ -56,8 +56,8 @@ class Main:
# main test # main test
def get_result(colorOnnx_path, yoloOnnx_path, image_path): def get_result(colorOnnx_path, yoloOnnx_path, image_arr):
m = Main(colorOnnx_path, yoloOnnx_path, image_path) m = Main(colorOnnx_path, yoloOnnx_path, image_arr)
color, bbox, category = m.colorAndbboxAndcategory() color, bbox, category = m.colorAndbboxAndcategory()
return color, bbox, category return color, bbox, category
...@@ -66,6 +66,13 @@ if __name__ == '__main__': ...@@ -66,6 +66,13 @@ if __name__ == '__main__':
colorOnnx_path = '/Users/apple/Desktop/color.onnx' colorOnnx_path = '/Users/apple/Desktop/color.onnx'
image_path = '/Users/apple/Desktop/8.jpg' image_path = '/Users/apple/Desktop/8.jpg'
yoloOnnx_path = '/Users/apple/Desktop/yolo3.onnx' yoloOnnx_path = '/Users/apple/Desktop/yolo3.onnx'
image_arr = cv2.imread(image_path)
color, bbox, category = get_result(colorOnnx_path, yoloOnnx_path, image_arr)
print(color)
print(bbox)
print(category)
"""
m = Main(colorOnnx_path, yoloOnnx_path, image_path) m = Main(colorOnnx_path, yoloOnnx_path, image_path)
color, bbox, category = m.colorAndbboxAndcategory() color, bbox, category = m.colorAndbboxAndcategory()
print('its color is : {}, category is : {} '.format(color, category)) print('its color is : {}, category is : {} '.format(color, category))
...@@ -73,4 +80,4 @@ if __name__ == '__main__': ...@@ -73,4 +80,4 @@ if __name__ == '__main__':
# print(color) # print(color)
# print(bbox) # print(bbox)
# print(category) # print(category)
"""
...@@ -12,6 +12,11 @@ def path2arr(path): ...@@ -12,6 +12,11 @@ def path2arr(path):
image = cv2.imread(path, cv2.IMREAD_COLOR) image = cv2.imread(path, cv2.IMREAD_COLOR)
return image return image
def arr2Img(image_arr):
image = Image.fromarray(image_arr)
return image
# this image is one Image type
def letterbox_image(image, size): def letterbox_image(image, size):
iw, ih = image.size iw, ih = image.size
h, w = size h, w = size
......
...@@ -10,7 +10,9 @@ setup( ...@@ -10,7 +10,9 @@ setup(
url = 'http://git.wanmeizhensuo.com/wujilong/onnx_model.git', url = 'http://git.wanmeizhensuo.com/wujilong/onnx_model.git',
author_email = 'wujilong@igengmei.com', author_email = 'wujilong@igengmei.com',
license = 'MIT', license = 'MIT',
packages = ['onnx_infer', 'onnx_infer.yolo3'], packages = ['onnx_infer.color', onnx_infer.croppic, onnx_infer.drawpic, 'onnx_infer.main',
'onnx_infer.onnx2kera', 'onnx_infer.supression', 'onnx_infer.yolodata',
'onnx_infer.yolo3.model', 'onnx_infer.yolo3.utils'],
) )
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