Commit c9da4748 authored by wangpeng's avatar wangpeng

打包完成

parent e2f9c348
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*~
# C extensions
*.so
src/
# Distribution / packaging
.Python
.vscode
index/
env/
bin/
build/
develop-eggs/
dist/
eggs/
lib/
lib64/
sdist/
var/
.idea/
*.egg-info/
.installed.cfg
*.egg
# Installer logs
pip-log.txt
pip-delete-this-directory.txt
# Unit test / coverage reports
htmlcov/
.tox/
.coverage
.cache
nosetests.xml
coverage.xml
# Translations
*.mo
# Mr Developer
.mr.developer.cfg
.project
.pydevproject
# Rope
.ropeproject
# Django stuff:
*.log
*.pot
# Sphinx documentation
docs/_build/
# config
fabfile.py
settings.online.py
/gaia/settings.py
settings_local.py
media/
log/
crawldata/
conf/
/static
.vagrant/
Vagrantfile
*.DS_Store
dump.rdb
# .gitignore for yangchuncheng
api/management/commands/ycc*
settings_override*
.script/
.tmp.sql
.env
*.pem
/gaia/hospital_list_settings.py
coverage_html/
gaia/rpcd.json
*.swp
.python-version
from onnx2kera import onnxinfere
from onnx_infer.onnx2kera import onnxinfere
import numpy as np
import cv2
from copy import deepcopy
......
# crop Image with threshold
import cv2
def cropImage(image, threshold_index):
return image[int(threshold_index[0]): int(threshold_index[2]),
int(threshold_index[1]): int(threshold_index[3])]
......@@ -9,7 +8,7 @@ def saveCrop(image, savePath):
cv2.imwrite(savePath, image)
if __name__ == '__main__':
from yolodata import path2arr
from onnx_infer.yolodata import path2arr
path = '/Users/apple/Desktop/8.jpg'
threshold_index = [95.55165, 184.0512, 250.18225, 333.9927]
image = path2arr(path)
......
#*******************
# *******************
"""
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。
......@@ -6,19 +6,20 @@ 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 result of this is the category and bounding box which is the max score.
"""
#*******************
# *******************
from yolodata import path2Img, letterbox_image, path2arr
from onnx2kera import onnxinfere
from supression import Supress
from onnx_infer.yolodata import path2Img, letterbox_image, path2arr
from onnx_infer.onnx2kera import onnxinfere
from onnx_infer.supression import Supress
import tensorflow as tf
from color import COLORS, featureTransform, resize, get_color
from croppic import cropImage
from onnx_infer.color import COLORS, featureTransform, resize, get_color
from onnx_infer.croppic import cropImage
#global
# 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):
self.colorOnnx_path = colorOnnx_path
......@@ -28,7 +29,6 @@ class Main:
self.iou = 0.05
self.picSize = (416, 416)
def bboxAndcategory(self):
bbox = []
category = []
......@@ -54,23 +54,26 @@ class Main:
color, ratio = get_color(self.colorOnnx_path, tmp, COLORS)
return color, bbox, category
# main test
colorOnnx_path = 'color.onnx'
yoloOnnx_path = 'yolo3.onnx'
def get_result(colorOnnx_path, yoloOnnx_path, image_path):
def get_result(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'
yoloOnnx_path = '/Users/apple/Desktop/yolo3.onnx'
m = Main(colorOnnx_path, yoloOnnx_path, image_path)
color, bbox, category = m.colorAndbboxAndcategory()
print('its color is : {}, category is : {} '.format(color, category))
print('the bounding box is : {}'.format(bbox))
# if __name__ == '__main__':
# colorOnnx_path = '/Users/apple/Desktop/color.onnx'
# image_path = '/Users/apple/Desktop/8.jpg'
# yoloOnnx_path = '/Users/apple/Desktop/yolo3.onnx'
# m = Main(colorOnnx_path, yoloOnnx_path, image_path)
# color, bbox, category = m.colorAndbboxAndcategory()
# print('its color is : {}, category is : {} '.format(color, category))
# print('the bounding box is : {}'.format(bbox))
# print(color)
# print(bbox)
# print(category)
......@@ -6,7 +6,7 @@ import cv2
import numpy as np
import keras.backend as k
import tensorflow as tf
from yolodata import path2Img, letterbox_image
from onnx_infer.yolodata import path2Img, letterbox_image
def hf2onnx(h5_path, save_path):
model = load_model(h5_path)
......@@ -23,7 +23,7 @@ def onnxinfere(onnx_path, input):
if __name__ == '__main__':
from supression import Supress
from onnx_infer.supression import Supress
# path = '/Users/apple/Public/keras-yolo3/model_data/our1_yolo.h5'
save_path = '/Users/apple/Desktop/yolo3.onnx'
anncorPath = 'model_data/yolo_anchors.txt'
......
import numpy as np
from keras import backend as k
from yolo3.model import yolo_eval
from onnx_infer.yolo3.model import yolo_eval
import os
class Supress:
......
......@@ -9,7 +9,7 @@ from keras.layers.normalization import BatchNormalization
from keras.models import Model
from keras.regularizers import l2
from yolo3.utils import compose
from onnx_infer.yolo3.utils import compose
@wraps(Conv2D)
......
#!/user/bin/python
from setuptools import setup, find_packages
from codecs import open
from os import path
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'],
__version__ = '0.1.0'
here = path.abspath(path.dirname(__file__))
)
# get the dependencies and installs
with open(path.join(here, 'requirements.txt'), encoding='utf-8') as f:
all_reqs = f.read().split('\n')
install_requires = [x.strip() for x in all_reqs if 'git+' not in x]
dependency_links = [x.strip().replace('git+', '') for x in all_reqs if x.startswith('git+')]
setup(
name='onnx_infer',
version=__version__,
description='A short description of the project',
url='https://github.com/Your github username/mxnet_insight',
download_url='https://github.com/Your github username/mxnet_insight/tarball/' + __version__,
license='BSD',
classifiers=[
'Development Status :: 3 - Alpha',
'Intended Audience :: Developers',
'Programming Language :: Python :: 3',
],
keywords='',
packages=['onnx_infer'],
include_package_data=True,
author='Your name',
install_requires=install_requires,
dependency_links=dependency_links,
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