Commit a68b5c32 authored by wangpeng's avatar wangpeng

合并代码,去掉编译器的文件

parents c9da4748 b3ed567c
...@@ -24,6 +24,7 @@ var/ ...@@ -24,6 +24,7 @@ var/
.installed.cfg .installed.cfg
*.egg *.egg
onnx_infer.egg-info
# Installer logs # Installer logs
pip-log.txt pip-log.txt
pip-delete-this-directory.txt pip-delete-this-directory.txt
...@@ -82,3 +83,4 @@ coverage_html/ ...@@ -82,3 +83,4 @@ coverage_html/
gaia/rpcd.json gaia/rpcd.json
*.swp *.swp
.python-version .python-version
.idea
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="JavaScriptSettings">
<option name="languageLevel" value="ES6" />
</component>
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.7" project-jdk-type="Python SDK" />
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/onnx.iml" filepath="$PROJECT_DIR$/.idea/onnx.iml" />
</modules>
</component>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<module type="PYTHON_MODULE" version="4">
<component name="NewModuleRootManager">
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/onnx_infer/yolo3" isTestSource="false" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
<component name="TestRunnerService">
<option name="PROJECT_TEST_RUNNER" value="Unittests" />
</component>
</module>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$" vcs="Git" />
</component>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ChangeListManager">
<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/supression.py" beforeDir="false" afterPath="$PROJECT_DIR$/onnx_infer/supression.py" afterDir="false" />
</list>
<option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
<option name="LAST_RESOLUTION" value="IGNORE" />
</component>
<component name="FileEditorManager">
<leaf>
<file pinned="false" current-in-tab="false">
<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>
</file>
<file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/onnx_infer/yolodata.py">
<provider selected="true" editor-type-id="text-editor">
<state>
<folding>
<element signature="e#0#21#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
</file>
<file pinned="false" current-in-tab="false">
<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>
</file>
<file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/onnx_infer/yolo3/utils.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="-208" />
</provider>
</entry>
</file>
<file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/onnx_infer/__init__.py">
<provider selected="true" editor-type-id="text-editor" />
</entry>
</file>
<file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/onnx_infer/color.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="-531">
<folding>
<element signature="e#0#32#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
</file>
<file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/onnx_infer/croppic.py">
<provider selected="true" editor-type-id="text-editor" />
</entry>
</file>
<file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/onnx_infer/drawpic.py">
<provider selected="true" editor-type-id="text-editor" />
</entry>
</file>
<file pinned="false" current-in-tab="true">
<entry file="file://$PROJECT_DIR$/onnx_infer/main.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="282">
<caret line="62" lean-forward="true" selection-start-line="62" selection-end-line="62" />
<folding>
<element signature="e#419#475#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
</file>
<file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/onnx_infer/onnx2kera.py">
<provider selected="true" editor-type-id="text-editor">
<state>
<folding>
<element signature="e#0#18#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
</file>
</leaf>
</component>
<component name="Git.Settings">
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
</component>
<component name="IdeDocumentHistory">
<option name="CHANGED_PATHS">
<list>
<option value="$PROJECT_DIR$/onnx_infer/main.py" />
<option value="$PROJECT_DIR$/onnx_infer/supression.py" />
</list>
</option>
</component>
<component name="ProjectFrameBounds">
<option name="x" value="40" />
<option name="y" value="111" />
<option name="width" value="1400" />
<option name="height" value="815" />
</component>
<component name="ProjectView">
<navigator proportions="" version="1">
<foldersAlwaysOnTop value="true" />
</navigator>
<panes>
<pane id="ProjectPane">
<subPane>
<expand>
<path>
<item name="onnx" type="b2602c69:ProjectViewProjectNode" />
<item name="onnx" type="462c0819:PsiDirectoryNode" />
</path>
<path>
<item name="onnx" type="b2602c69:ProjectViewProjectNode" />
<item name="onnx" type="462c0819:PsiDirectoryNode" />
<item name="onnx_infer" type="462c0819:PsiDirectoryNode" />
</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>
<item name="onnx" type="b2602c69:ProjectViewProjectNode" />
<item name="onnx" type="462c0819:PsiDirectoryNode" />
<item name="onnx_infer" type="462c0819:PsiDirectoryNode" />
<item name="yolo3" type="462c0819:PsiDirectoryNode" />
</path>
</expand>
<select />
</subPane>
</pane>
<pane id="Scope" />
</panes>
</component>
<component name="PropertiesComponent">
<property name="WebServerToolWindowFactoryState" value="false" />
<property name="node.js.detected.package.eslint" value="true" />
<property name="node.js.detected.package.tslint" value="true" />
<property name="node.js.path.for.package.eslint" value="project" />
<property name="node.js.path.for.package.tslint" value="project" />
<property name="node.js.selected.package.eslint" value="(autodetect)" />
<property name="node.js.selected.package.tslint" value="(autodetect)" />
<property name="nodejs_interpreter_path.stuck_in_default_project" value="undefined stuck path" />
<property name="nodejs_npm_path_reset_for_default_project" value="true" />
</component>
<component name="RunDashboard">
<option name="ruleStates">
<list>
<RuleState>
<option name="name" value="ConfigurationTypeDashboardGroupingRule" />
</RuleState>
<RuleState>
<option name="name" value="StatusDashboardGroupingRule" />
</RuleState>
</list>
</option>
</component>
<component name="RunManager" selected="Python.main">
<configuration name="main" type="PythonConfigurationType" factoryName="Python" temporary="true">
<module name="onnx" />
<option name="INTERPRETER_OPTIONS" value="" />
<option name="PARENT_ENVS" value="true" />
<envs>
<env name="PYTHONUNBUFFERED" value="1" />
</envs>
<option name="SDK_HOME" value="" />
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$/onnx_infer" />
<option name="IS_MODULE_SDK" value="true" />
<option name="ADD_CONTENT_ROOTS" value="true" />
<option name="ADD_SOURCE_ROOTS" value="true" />
<EXTENSION ID="PythonCoverageRunConfigurationExtension" runner="coverage.py" />
<option name="SCRIPT_NAME" value="$PROJECT_DIR$/onnx_infer/main.py" />
<option name="PARAMETERS" value="" />
<option name="SHOW_COMMAND_LINE" value="false" />
<option name="EMULATE_TERMINAL" value="false" />
<option name="MODULE_MODE" value="false" />
<option name="REDIRECT_INPUT" value="false" />
<option name="INPUT_FILE" value="" />
<method v="2" />
</configuration>
<configuration name="supression" type="PythonConfigurationType" factoryName="Python" temporary="true">
<module name="onnx" />
<option name="INTERPRETER_OPTIONS" value="" />
<option name="PARENT_ENVS" value="true" />
<envs>
<env name="PYTHONUNBUFFERED" value="1" />
</envs>
<option name="SDK_HOME" value="" />
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$/onnx_infer" />
<option name="IS_MODULE_SDK" value="true" />
<option name="ADD_CONTENT_ROOTS" value="true" />
<option name="ADD_SOURCE_ROOTS" value="true" />
<EXTENSION ID="PythonCoverageRunConfigurationExtension" runner="coverage.py" />
<option name="SCRIPT_NAME" value="$PROJECT_DIR$/onnx_infer/supression.py" />
<option name="PARAMETERS" value="" />
<option name="SHOW_COMMAND_LINE" value="false" />
<option name="EMULATE_TERMINAL" value="false" />
<option name="MODULE_MODE" value="false" />
<option name="REDIRECT_INPUT" value="false" />
<option name="INPUT_FILE" value="" />
<method v="2" />
</configuration>
<recent_temporary>
<list>
<item itemvalue="Python.main" />
<item itemvalue="Python.supression" />
</list>
</recent_temporary>
</component>
<component name="SvnConfiguration">
<configuration />
</component>
<component name="TaskManager">
<task active="true" id="Default" summary="Default task">
<changelist id="c99523d9-010f-4b7a-8f3f-0e626959dd1a" name="Default Changelist" comment="" />
<created>1563429063264</created>
<option name="number" value="Default" />
<option name="presentableId" value="Default" />
<updated>1563429063264</updated>
<workItem from="1563429064722" duration="31000" />
<workItem from="1563429380140" duration="1971000" />
</task>
<servers />
</component>
<component name="TimeTrackingManager">
<option name="totallyTimeSpent" value="2002000" />
</component>
<component name="ToolWindowManager">
<frame x="40" y="111" width="1400" height="815" extended-state="0" />
<editor active="true" />
<layout>
<window_info content_ui="combo" id="Project" order="0" visible="true" weight="0.2533137" />
<window_info id="Structure" order="1" side_tool="true" weight="0.25" />
<window_info id="Favorites" order="2" side_tool="true" />
<window_info anchor="bottom" id="Message" order="0" />
<window_info anchor="bottom" id="Find" order="1" />
<window_info anchor="bottom" id="Run" order="2" weight="0.5504841" />
<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="Inspection" order="5" weight="0.4" />
<window_info anchor="bottom" id="TODO" order="6" />
<window_info anchor="bottom" id="Docker" order="7" show_stripe_button="false" />
<window_info anchor="bottom" id="Version Control" order="8" />
<window_info anchor="bottom" id="Database Changes" order="9" />
<window_info anchor="bottom" id="Event Log" order="10" side_tool="true" />
<window_info anchor="bottom" id="Terminal" order="11" />
<window_info anchor="bottom" id="Python Console" order="12" />
<window_info anchor="right" id="Commander" internal_type="SLIDING" order="0" type="SLIDING" weight="0.4" />
<window_info anchor="right" id="Ant Build" order="1" weight="0.25" />
<window_info anchor="right" content_ui="combo" id="Hierarchy" order="2" weight="0.25" />
<window_info anchor="right" id="SciView" order="3" />
<window_info anchor="right" id="Database" order="4" />
</layout>
</component>
<component name="TypeScriptGeneratedFilesManager">
<option name="version" value="1" />
</component>
<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$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" />
</component>
<component name="editorHistoryManager">
<entry file="file://$PROJECT_DIR$/onnx_infer/model_data/yolo_anchors.txt">
<provider selected="true" editor-type-id="text-editor" />
</entry>
<entry file="file://$PROJECT_DIR$/onnx_infer/yolo3/utils.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="-208" />
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/onnx_infer/__init__.py">
<provider selected="true" editor-type-id="text-editor" />
</entry>
<entry file="file://$PROJECT_DIR$/onnx_infer/color.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="-531">
<folding>
<element signature="e#0#32#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/onnx_infer/croppic.py">
<provider selected="true" editor-type-id="text-editor" />
</entry>
<entry file="file://$PROJECT_DIR$/onnx_infer/drawpic.py">
<provider selected="true" editor-type-id="text-editor" />
</entry>
<entry file="file://$PROJECT_DIR$/onnx_infer/onnx2kera.py">
<provider selected="true" editor-type-id="text-editor">
<state>
<folding>
<element signature="e#0#18#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/onnx_infer/yolodata.py">
<provider selected="true" editor-type-id="text-editor">
<state>
<folding>
<element signature="e#0#21#0" expanded="true" />
</folding>
</state>
</provider>
</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">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="282">
<caret line="62" lean-forward="true" selection-start-line="62" selection-end-line="62" />
<folding>
<element signature="e#419#475#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
</component>
</project>
\ No newline at end of file
# ******************* #*******************
""" """
this is the main which contain color and yolo this is the main which contain color and yolo
the color input need abs path of color.onnx and one image arr which generate from the croppic.py。 the color input need abs path of color.onnx and one image arr which generate from the croppic.py。
...@@ -6,9 +6,9 @@ the result is the color of the picture。 ...@@ -6,9 +6,9 @@ the result is the color of the picture。
the yolo is more complex, need, the path of anchor.txt, label.txt, and the image path, the yolo.onnx path the yolo is more complex, need, the path of anchor.txt, label.txt, and the image path, the yolo.onnx path
the result of this is the category and bounding box which is the max score. the result of this is the category and bounding box which is the max score.
""" """
# ******************* #*******************
from onnx_infer.yolodata import path2Img, letterbox_image, path2arr from onnx_infer.yolodata import letterbox_image, path2arr,arr2Img
from onnx_infer.onnx2kera import onnxinfere from onnx_infer.onnx2kera import onnxinfere
from onnx_infer.supression import Supress from onnx_infer.supression import Supress
import tensorflow as tf import tensorflow as tf
...@@ -21,18 +21,19 @@ categorys = ['long sleeve dress', 'vest dress', 'vest', 'long sleeve outwear', ' ...@@ -21,18 +21,19 @@ categorys = ['long sleeve dress', 'vest dress', 'vest', 'long sleeve outwear', '
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)
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 +48,7 @@ class Main: ...@@ -47,7 +48,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)
...@@ -59,21 +60,21 @@ class Main: ...@@ -59,21 +60,21 @@ class Main:
colorOnnx_path = 'color.onnx' colorOnnx_path = 'color.onnx'
yoloOnnx_path = 'yolo3.onnx' yoloOnnx_path = 'yolo3.onnx'
def get_result(image_arr):
def get_result(image_path): m = Main(colorOnnx_path, yoloOnnx_path, image_arr)
m = Main(colorOnnx_path, yoloOnnx_path, image_path)
color, bbox, category = m.colorAndbboxAndcategory() color, bbox, category = m.colorAndbboxAndcategory()
return color, bbox, category return color, bbox, category
# if __name__ == '__main__': 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'
# 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))
# print('the bounding box is : {}'.format(bbox)) print('the bounding box is : {}'.format(bbox))
# 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
......
...@@ -33,3 +33,4 @@ setup( ...@@ -33,3 +33,4 @@ setup(
dependency_links=dependency_links, dependency_links=dependency_links,
author_email='Your address email (eq. you@example.com)' author_email='Your address email (eq. you@example.com)'
) )
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