Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
O
onnx_model
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
武继龙
onnx_model
Commits
8a92775d
Commit
8a92775d
authored
Jul 18, 2019
by
武继龙
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
modify input
parent
e2f9c348
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
24 additions
and
10 deletions
+24
-10
.DS_Store
.DS_Store
+0
-0
workspace.xml
.idea/workspace.xml
+0
-0
.DS_Store
onnx_infer/.DS_Store
+0
-0
yolodata.cpython-37.pyc
onnx_infer/__pycache__/yolodata.cpython-37.pyc
+0
-0
main.py
onnx_infer/main.py
+16
-9
yolodata.py
onnx_infer/yolodata.py
+5
-0
setup.py
setup.py
+3
-1
No files found.
.DS_Store
View file @
8a92775d
No preview for this file type
.idea/workspace.xml
View file @
8a92775d
This diff is collapsed.
Click to expand it.
onnx_infer/.DS_Store
View file @
8a92775d
No preview for this file type
onnx_infer/__pycache__/yolodata.cpython-37.pyc
View file @
8a92775d
No preview for this file type
onnx_infer/main.py
View file @
8a92775d
...
...
@@ -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
supression
import
Supress
import
tensorflow
as
tf
from
color
import
COLORS
,
featureTransform
,
resize
,
get_color
from
croppic
import
cropImage
import
cv2
#global
categorys
=
[
'long sleeve dress'
,
'vest dress'
,
'vest'
,
'long sleeve outwear'
,
'long sleeve top'
,
'trousers'
,
'short sleeve top'
,
'sling dress'
,
'skirt'
,
'short sleeve dress'
,
'shorts'
]
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
.
yoloOnnx_path
=
yoloOnnx_path
self
.
image_
path
=
image_path
self
.
image_
arr
=
image_arr
self
.
score
=
0.05
self
.
iou
=
0.05
self
.
picSize
=
(
416
,
416
)
...
...
@@ -32,7 +32,7 @@ class Main:
def
bboxAndcategory
(
self
):
bbox
=
[]
category
=
[]
image
=
path2Img
(
self
.
image_path
)
image
=
arr2Img
(
self
.
image_arr
)
image_data
=
letterbox_image
(
image
,
self
.
picSize
)
precit
=
onnxinfere
(
self
.
yoloOnnx_path
,
image_data
)
feature
=
[]
...
...
@@ -47,7 +47,7 @@ class Main:
def
colorAndbboxAndcategory
(
self
):
bbox
,
category
=
self
.
bboxAndcategory
()
image_arr
=
path2arr
(
self
.
image_path
)
image_arr
=
self
.
image_arr
image_crop
=
cropImage
(
image_arr
,
bbox
)
resized
=
resize
(
image_crop
)
tmp
=
featureTransform
(
resized
)
...
...
@@ -56,8 +56,8 @@ class Main:
# main test
def
get_result
(
colorOnnx_path
,
yoloOnnx_path
,
image_
path
):
m
=
Main
(
colorOnnx_path
,
yoloOnnx_path
,
image_
path
)
def
get_result
(
colorOnnx_path
,
yoloOnnx_path
,
image_
arr
):
m
=
Main
(
colorOnnx_path
,
yoloOnnx_path
,
image_
arr
)
color
,
bbox
,
category
=
m
.
colorAndbboxAndcategory
()
return
color
,
bbox
,
category
...
...
@@ -66,6 +66,13 @@ if __name__ == '__main__':
colorOnnx_path
=
'/Users/apple/Desktop/color.onnx'
image_path
=
'/Users/apple/Desktop/8.jpg'
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)
color, bbox, category = m.colorAndbboxAndcategory()
print('its color is : {}, category is : {} '.format(color, category))
...
...
@@ -73,4 +80,4 @@ if __name__ == '__main__':
# print(color)
# print(bbox)
# print(category)
"""
onnx_infer/yolodata.py
View file @
8a92775d
...
...
@@ -12,6 +12,11 @@ def path2arr(path):
image
=
cv2
.
imread
(
path
,
cv2
.
IMREAD_COLOR
)
return
image
def
arr2Img
(
image_arr
):
image
=
Image
.
fromarray
(
image_arr
)
return
image
# this image is one Image type
def
letterbox_image
(
image
,
size
):
iw
,
ih
=
image
.
size
h
,
w
=
size
...
...
setup.py
View file @
8a92775d
...
...
@@ -10,7 +10,9 @@ setup(
url
=
'http://git.wanmeizhensuo.com/wujilong/onnx_model.git'
,
author_email
=
'wujilong@igengmei.com'
,
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'
],
)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment