Browse Source

Adapt to new version

pull/4/head
xsl 4 years ago
parent
commit
be620ff844
17 changed files with 219 additions and 154 deletions
  1. +11
    -0
      .idea/HyperLPR.iml
  2. +4
    -0
      .idea/misc.xml
  3. +8
    -0
      .idea/modules.xml
  4. +6
    -0
      .idea/vcs.xml
  5. +171
    -0
      .idea/workspace.xml
  6. +0
    -75
      benchmark.py
  7. +0
    -18
      config.json
  8. +1
    -1
      hyperlpr/pipline.py
  9. +1
    -1
      hyperlpr/recognizer.py
  10. +1
    -1
      hyperlpr/segmentation.py
  11. +1
    -1
      hyperlpr/typeDistinguish.py
  12. +1
    -1
      hyperlpr_py3/pipline.py
  13. +1
    -1
      hyperlpr_py3/recognizer.py
  14. +1
    -1
      hyperlpr_py3/segmentation.py
  15. +1
    -1
      hyperlpr_py3/typeDistinguish.py
  16. BIN
      model/plate_type.h5
  17. +11
    -53
      requirements.txt

+ 11
- 0
.idea/HyperLPR.iml View File

@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="PYTHON_MODULE" version="4">
<component name="NewModuleRootManager">
<content url="file://$MODULE_DIR$" />
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
<component name="TestRunnerService">
<option name="PROJECT_TEST_RUNNER" value="Unittests" />
</component>
</module>

+ 4
- 0
.idea/misc.xml View File

@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.5" project-jdk-type="Python SDK" />
</project>

+ 8
- 0
.idea/modules.xml View File

@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/HyperLPR.iml" filepath="$PROJECT_DIR$/.idea/HyperLPR.iml" />
</modules>
</component>
</project>

+ 6
- 0
.idea/vcs.xml View File

@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$" vcs="Git" />
</component>
</project>

+ 171
- 0
.idea/workspace.xml View File

@@ -0,0 +1,171 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ChangeListManager">
<list default="true" id="c514fefb-e579-4297-b908-55de31256ade" name="Default" comment="">
<change beforePath="$PROJECT_DIR$/benchmark.py" afterPath="" />
<change beforePath="$PROJECT_DIR$/config.json" afterPath="" />
<change beforePath="$PROJECT_DIR$/hyperlpr/pipline.py" afterPath="$PROJECT_DIR$/hyperlpr/pipline.py" />
<change beforePath="$PROJECT_DIR$/hyperlpr/recognizer.py" afterPath="$PROJECT_DIR$/hyperlpr/recognizer.py" />
<change beforePath="$PROJECT_DIR$/hyperlpr/segmentation.py" afterPath="$PROJECT_DIR$/hyperlpr/segmentation.py" />
<change beforePath="$PROJECT_DIR$/hyperlpr/typeDistinguish.py" afterPath="$PROJECT_DIR$/hyperlpr/typeDistinguish.py" />
<change beforePath="$PROJECT_DIR$/hyperlpr_py3/pipline.py" afterPath="$PROJECT_DIR$/hyperlpr_py3/pipline.py" />
<change beforePath="$PROJECT_DIR$/hyperlpr_py3/recognizer.py" afterPath="$PROJECT_DIR$/hyperlpr_py3/recognizer.py" />
<change beforePath="$PROJECT_DIR$/hyperlpr_py3/segmentation.py" afterPath="$PROJECT_DIR$/hyperlpr_py3/segmentation.py" />
<change beforePath="$PROJECT_DIR$/hyperlpr_py3/typeDistinguish.py" afterPath="$PROJECT_DIR$/hyperlpr_py3/typeDistinguish.py" />
<change beforePath="$PROJECT_DIR$/model/plate_type.h5" afterPath="$PROJECT_DIR$/model/plate_type.h5" />
</list>
<option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
<option name="TRACKING_ENABLED" 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 leaf-file-name="pipline.py" pinned="false" current-in-tab="true">
<entry file="file://$PROJECT_DIR$/hyperlpr_py3/pipline.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="90">
<caret line="153" column="0" lean-forward="false" selection-start-line="153" selection-start-column="0" selection-end-line="153" selection-end-column="0" />
<folding />
</state>
</provider>
</entry>
</file>
</leaf>
</component>
<component name="FileTemplateManagerImpl">
<option name="RECENT_TEMPLATES">
<list>
<option value="Python Script" />
</list>
</option>
</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$/demo_py3.py" />
</list>
</option>
</component>
<component name="ProjectFrameBounds" extendedState="6">
<option name="x" value="493" />
<option name="y" value="84" />
<option name="width" value="1085" />
<option name="height" value="704" />
</component>
<component name="ProjectView">
<navigator currentView="ProjectPane" proportions="" version="1">
<flattenPackages />
<showMembers />
<showModules />
<showLibraryContents />
<hideEmptyPackages />
<abbreviatePackageNames />
<autoscrollToSource />
<autoscrollFromSource />
<sortByType />
<manualOrder />
<foldersAlwaysOnTop value="true" />
</navigator>
<panes>
<pane id="Scratches" />
<pane id="Scope" />
<pane id="ProjectPane">
<subPane>
<expand>
<path>
<item name="HyperLPR" type="b2602c69:ProjectViewProjectNode" />
<item name="HyperLPR" type="462c0819:PsiDirectoryNode" />
</path>
<path>
<item name="HyperLPR" type="b2602c69:ProjectViewProjectNode" />
<item name="HyperLPR" type="462c0819:PsiDirectoryNode" />
<item name="hyperlpr_py3" type="462c0819:PsiDirectoryNode" />
</path>
</expand>
<select />
</subPane>
</pane>
</panes>
</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="ShelveChangesManager" show_recycled="false">
<option name="remove_strategy" value="false" />
</component>
<component name="SvnConfiguration">
<configuration />
</component>
<component name="TaskManager">
<task active="true" id="Default" summary="Default task">
<changelist id="c514fefb-e579-4297-b908-55de31256ade" name="Default" comment="" />
<created>1591067075688</created>
<option name="number" value="Default" />
<option name="presentableId" value="Default" />
<updated>1591067075688</updated>
</task>
<servers />
</component>
<component name="ToolWindowManager">
<frame x="65" y="-4" width="1855" height="940" extended-state="6" />
<layout>
<window_info id="Project" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.24959569" sideWeight="0.5" order="0" side_tool="false" content_ui="combo" />
<window_info id="TODO" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="6" side_tool="false" content_ui="tabs" />
<window_info id="Event Log" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="-1" side_tool="true" content_ui="tabs" />
<window_info id="Run" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
<window_info id="Version Control" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="-1" side_tool="false" content_ui="tabs" />
<window_info id="Python Console" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="-1" side_tool="false" content_ui="tabs" />
<window_info id="Structure" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
<window_info id="Terminal" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="-1" side_tool="false" content_ui="tabs" />
<window_info id="Debug" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.4" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
<window_info id="Favorites" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="-1" side_tool="true" content_ui="tabs" />
<window_info id="Cvs" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="4" side_tool="false" content_ui="tabs" />
<window_info id="Hierarchy" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="2" side_tool="false" content_ui="combo" />
<window_info id="Message" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" />
<window_info id="Commander" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.4" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" />
<window_info id="Find" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
<window_info id="Inspection" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.4" sideWeight="0.5" order="5" side_tool="false" content_ui="tabs" />
<window_info id="Ant Build" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
</layout>
</component>
<component name="VcsContentAnnotationSettings">
<option name="myLimit" value="2678400000" />
</component>
<component name="XDebuggerManager">
<breakpoint-manager />
<watches-manager />
</component>
<component name="editorHistoryManager">
<entry file="file://$PROJECT_DIR$/demo_py3.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="90">
<caret line="5" column="39" lean-forward="false" selection-start-line="5" selection-start-column="39" selection-end-line="5" selection-end-column="39" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/hyperlpr_py3/pipline.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="90">
<caret line="153" column="0" lean-forward="false" selection-start-line="153" selection-start-column="0" selection-end-line="153" selection-end-column="0" />
<folding />
</state>
</provider>
</entry>
</component>
</project>

+ 0
- 75
benchmark.py View File

@@ -1,75 +0,0 @@
#coding=utf-8
import os
import numpy as np
import cv2
import json
from hyperlpr import pipline as pp
import sys
from Levenshtein import StringMatcher as sm

reload(sys)
sys.setdefaultencoding("utf-8")
parent= "you folder"

def comparestring(a,b):
g = 0
if len(a) == len(b):
for x,y in zip(a,b):
if x!=y:
g+=1
return g
count = 0 ;
count_p = 0
count_d = 0
count_lev = 0
count_undetected = 0
roi = [470,400,650,580]
for filename in os.listdir(parent):

path = os.path.join(parent,filename)
print path

if path.endswith(".jpg") or path.endswith(".png"):
ics,name = os.path.split(path)


name,ext = name.split(".")

image = cv2.imread(path)
image = image[roi[1]:roi[1]+roi[3],roi[0]:roi[0]+roi[2]]
# cv2.imshow("test",image)
# cv2.waitKey(0)
info,dataset = pp.SimpleRecognizePlate(image)
ext = ext.strip()
name = name.strip()

if len(dataset)==0:
count_undetected +=1

# cv2.imwrite("./cache/bad2/" + name + ".png", image)

for one in dataset:

# p = sm.StringMatcher(seq1=one.encode("utf-8"),seq2=name.encode("utf-8"))
A = one.decode("utf-8")
B = name.decode("utf-8")
print one.decode("utf-8"),"<->",name.decode("utf-8"),"编辑距离:",comparestring(A,B)
if comparestring(A,B)<3:
count_lev+=1
else:
cv2.imwrite("./cache/bad2/"+B+"->"+A+".png",image)

if one.decode("utf-8") == name.decode("utf-8"):
count_p+=1
break
else:
print "error",one.decode("utf-8"), name.decode("utf-8")
count_d+=1
# cv2.imshow("image",image)
# cv2.waitKey(0)
# break
count+=1
print count_p / float(count),"编辑距离[1]:",count_lev/float(count),u"识出",count_p,u"总数",count,u"未识出",count_d,u"未检测出",count_undetected
if count_p+count_d+count_undetected!=count:
print dataset,len(dataset)
# exit(0)

+ 0
- 18
config.json View File

@@ -1,18 +0,0 @@
{
"global":{
"debug":true
},
"log":{
},
"detect":{
},
"recognize":{
},
"detectTest":{
"detectPath":"/Users/universe/Documents/work/data/Plate/boundingbox",
"outputPath":"/Users/universe/ProgramUniverse/python/Forked/HyperLPR/out/detect_test"
},
"colorTest":{
"colorPath":"/Users/universe/Documents/work/data/Plate/colour/u"
}
}

+ 1
- 1
hyperlpr/pipline.py View File

@@ -185,7 +185,7 @@ def SimpleRecognizePlateByE2E(image):
image_rgb = fv.finemappingVertical(image_rgb)
image_rgb = fv.finemappingVertical(image_rgb)
cache.verticalMappingToFolder(image_rgb)
cv2.imwrite("./"+str(j)+".jpg",image_rgb)
#cv2.imwrite("./"+str(j)+".jpg",image_rgb)
res,confidence = e2e.recognizeOne(image_rgb)
print res,confidence
res_set.append([[],res,confidence])


+ 1
- 1
hyperlpr/recognizer.py View File

@@ -5,7 +5,7 @@ from keras.layers import Conv2D,MaxPool2D
from keras.optimizers import SGD
from keras import backend as K

K.set_image_dim_ordering('tf')
K.image_data_format()


import cv2


+ 1
- 1
hyperlpr/segmentation.py View File

@@ -19,7 +19,7 @@ from keras.layers import Conv2D, MaxPool2D
from keras.optimizers import SGD
from keras import backend as K

K.set_image_dim_ordering('tf')
K.image_data_format()


def Getmodel_tensorflow(nb_classes):


+ 1
- 1
hyperlpr/typeDistinguish.py View File

@@ -5,7 +5,7 @@ from keras.layers import Conv2D, MaxPool2D
from keras.optimizers import SGD
from keras import backend as K

K.set_image_dim_ordering('tf')
K.image_data_format()


import cv2


+ 1
- 1
hyperlpr_py3/pipline.py View File

@@ -172,7 +172,7 @@ def SimpleRecognizePlateByE2E(image):
image_rgb = fv.finemappingVertical(image_rgb)
image_rgb = fv.finemappingVertical(image_rgb)
cache.verticalMappingToFolder(image_rgb)
cv2.imwrite("./"+str(j)+".jpg",image_rgb)
#cv2.imwrite("./"+str(j)+".jpg",image_rgb)
res,confidence = e2e.recognizeOne(image_rgb)
print(res,confidence)
res_set.append([[],res,confidence])


+ 1
- 1
hyperlpr_py3/recognizer.py View File

@@ -5,7 +5,7 @@ from keras.layers import Conv2D,MaxPool2D
from keras.optimizers import SGD
from keras import backend as K

K.set_image_dim_ordering('tf')
K.image_data_format()


import cv2


+ 1
- 1
hyperlpr_py3/segmentation.py View File

@@ -19,7 +19,7 @@ from keras.layers import Conv2D, MaxPool2D
from keras.optimizers import SGD
from keras import backend as K

K.set_image_dim_ordering('tf')
K.image_data_format()


def Getmodel_tensorflow(nb_classes):


+ 1
- 1
hyperlpr_py3/typeDistinguish.py View File

@@ -5,7 +5,7 @@ from keras.layers import Conv2D, MaxPool2D
from keras.optimizers import SGD
from keras import backend as K

K.set_image_dim_ordering('tf')
K.image_data_format()


import cv2


BIN
model/plate_type.h5 View File


+ 11
- 53
requirements.txt View File

@@ -1,53 +1,11 @@
absl-py==0.9.0
alembic==1.4.2
astor==0.8.1
click==7.1.1
cycler==0.10.0
decorator==4.4.2
Flask==1.0
Flask-Migrate==2.5.3
Flask-MySQLdb==0.2.0
Flask-Script==2.0.6
Flask-Session==0.3.1
Flask-SQLAlchemy==2.4.1
gast==0.3.3
grpcio==1.27.2
h5py==2.10.0
imageio==2.8.0
itsdangerous==1.1.0
Jinja2==2.11.1
joblib==0.14.1
Keras==2.1.1
Keras-Applications==1.0.8
Keras-Preprocessing==1.1.0
kiwisolver==1.1.0
Mako==1.1.2
Markdown==3.2.1
MarkupSafe==1.1.1
matplotlib==3.2.1
mock==4.0.2
mysqlclient==1.4.6
networkx==2.4
numpy==1.17.4
opencv-contrib-python==3.4.2.16
opencv-python==3.4.2.16
Pillow==7.0.0
protobuf==3.11.3
pyparsing==2.4.6
python-dateutil==2.8.1
python-editor==1.0.4
PyWavelets==1.1.1
PyYAML==5.3.1
redis==3.4.1
scikit-image==0.16.2
scikit-learn==0.22.2.post1
scipy==1.4.1
six==1.14.0
sklearn==0.0
SQLAlchemy==1.3.15
tensorboard==1.13.1
tensorflow==1.15.2
tensorflow-estimator==1.13.0
termcolor==1.1.0
Theano==1.0.4
Werkzeug==1.0.0
matplotlib==2.2.4
opencv_contrib_python==3.4.3.18
numpy==1.16.6
Keras==2.3.1
Werkzeug==0.14.1
scipy==1.2.2
Flask==1.1.2
Pillow==7.1.2
PyQt5==5.15.0
scikit_learn==0.23.1
wxpy==0.3.9.8

Loading…
Cancel
Save