Commit e2f9c348 authored by 武继龙's avatar 武继龙

add one function

parent f94a4f95
No preview for this file type
<?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
......@@ -24,8 +24,6 @@ class Main:
self.colorOnnx_path = colorOnnx_path
self.yoloOnnx_path = yoloOnnx_path
self.image_path = image_path
self.anchor_path = 'model_data/yolo_anchors.txt'
self.classes_path = 'model_data/deepfashion.txt'
self.score = 0.05
self.iou = 0.05
self.picSize = (416, 416)
......@@ -40,7 +38,7 @@ class Main:
feature = []
for f in precit:
feature.append(tf.convert_to_tensor(f))
sup = Supress(self.anchor_path, self.classes_path, self.score, self.iou, feature)
sup = Supress(self.score, self.iou, feature)
box, score, classes = sup.detect(image)
with tf.Session() as sess:
bbox = box.eval()[0]
......@@ -58,6 +56,12 @@ class Main:
# main test
def get_result(colorOnnx_path, yoloOnnx_path, image_path):
m = Main(colorOnnx_path, yoloOnnx_path, image_path)
color, bbox, category = m.colorAndbboxAndcategory()
return color, bbox, category
if __name__ == '__main__':
colorOnnx_path = '/Users/apple/Desktop/color.onnx'
image_path = '/Users/apple/Desktop/8.jpg'
......
long sleeve dress
vest dress
vest
long sleeve outwear
long sleeve top
trousers
short sleeve top
sling dress
skirt
short sleeve dress
shorts
10,13, 16,30, 33,23, 30,61, 62,45, 59,119, 116,90, 156,198, 373,326
......@@ -4,9 +4,7 @@ from yolo3.model import yolo_eval
import os
class Supress:
def __init__(self, anchorPath, classPath, score, iou, featureMap):
self.anchorPath = anchorPath
self.classPath = classPath
def __init__(self, score, iou, featureMap):
self.score = score
self.iou = iou
self.featureMap = featureMap
......@@ -14,18 +12,14 @@ class Supress:
def _get_class(self):
classes_path = os.path.expanduser(self.classPath)
with open(classes_path) as f:
classNames = f.readlines()
classNames = [x.strip() for x in classNames]
classNames = ['long sleeve dress', 'vest dress', 'vest', 'long sleeve outwear', 'long sleeve top', 'trousers',
'short sleeve top', 'sling dress', 'skirt', 'short sleeve dress', 'shorts']
return classNames
def _get_anchors(self):
anchorPath = os.path.expanduser(self.anchorPath)
with open(anchorPath) as f:
anchors = f.readline()
anchors = [float(x) for x in anchors.split(',')]
return np.array(anchors).reshape(-1, 2)
anchors = [[10., 13.], [16., 30.], [33., 23.], [30., 61.], [62., 45.],
[59., 119.], [116., 90.], [156., 198.], [373., 326.]]
return np.array(anchors)
def detect(self, image):
anchors = self._get_anchors()
......
#!/user/bin/python
from setuptools import setup, find_packages
setup(
name = 'onnx_infer',
version = '0.1.0',
description = 'model inference',
author = 'wjl',
url = 'http://git.wanmeizhensuo.com/wujilong/onnx_model.git',
author_email = 'wujilong@igengmei.com',
license = 'MIT',
packages = ['onnx_infer', 'onnx_infer.yolo3'],
)
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