Browse Source

Merge branch 'develop' of gitadmin/tuoheng_alg into release

tags/V2.7.3^2
chenyukun 1 year ago
parent
commit
c5eefe2505
16 changed files with 432 additions and 248 deletions
  1. +62
    -64
      .idea/workspace.xml
  2. +22
    -0
      common/Constant.py
  3. +134
    -0
      common/YmlConstant.py
  4. +35
    -6
      concurrency/IntelligentRecognitionProcess.py
  5. +0
    -3
      concurrency/PullStreamThread.py
  6. +0
    -43
      config/ModelConfig.py
  7. +0
    -0
      test/color/__init__.py
  8. +73
    -0
      test/color/color_test.py
  9. BIN
      test/color/platech.ttf
  10. +46
    -43
      util/AliyunSdk.py
  11. +2
    -2
      util/Cv2Utils.py
  12. +11
    -10
      util/GPUtils.py
  13. +11
    -10
      util/ImgBaiduSdk.py
  14. +17
    -14
      util/LogUtils.py
  15. +13
    -49
      util/ModelUtils.py
  16. +6
    -4
      util/OcrBaiduSdk.py

+ 62
- 64
.idea/workspace.xml View File

@@ -5,14 +5,9 @@
</component>
<component name="ChangeListManager">
<list default="true" id="4f7dccd9-8f92-4a6e-90cc-33890d102263" name="Changes" comment="Changes">
<change beforePath="$PROJECT_DIR$/.idea/inspectionProfiles/Project_Default.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/inspectionProfiles/Project_Default.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/concurrency/FeedbackThread.py" beforeDir="false" afterPath="$PROJECT_DIR$/concurrency/FeedbackThread.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/concurrency/IntelligentRecognitionProcess.py" beforeDir="false" afterPath="$PROJECT_DIR$/concurrency/IntelligentRecognitionProcess.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/service/Dispatcher.py" beforeDir="false" afterPath="$PROJECT_DIR$/service/Dispatcher.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/util/KafkaUtils.py" beforeDir="false" afterPath="$PROJECT_DIR$/util/KafkaUtils.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/common/Constant.py" beforeDir="false" afterPath="$PROJECT_DIR$/common/Constant.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/util/ModelUtils.py" beforeDir="false" afterPath="$PROJECT_DIR$/util/ModelUtils.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/util/YmlUtils.py" beforeDir="false" afterPath="$PROJECT_DIR$/util/YmlUtils.py" afterDir="false" />
</list>
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
@@ -131,35 +126,35 @@
<option name="hideEmptyMiddlePackages" value="true" />
<option name="showLibraryContents" value="true" />
</component>
<component name="PropertiesComponent">{
&quot;keyToString&quot;: {
&quot;RunOnceActivity.OpenProjectViewOnStart&quot;: &quot;true&quot;,
&quot;RunOnceActivity.ShowReadmeOnStart&quot;: &quot;true&quot;,
&quot;WebServerToolWindowFactoryState&quot;: &quot;true&quot;,
&quot;WebServerToolWindowPanel.toolwindow.highlight.mappings&quot;: &quot;true&quot;,
&quot;WebServerToolWindowPanel.toolwindow.highlight.symlinks&quot;: &quot;true&quot;,
&quot;WebServerToolWindowPanel.toolwindow.show.date&quot;: &quot;false&quot;,
&quot;WebServerToolWindowPanel.toolwindow.show.permissions&quot;: &quot;false&quot;,
&quot;WebServerToolWindowPanel.toolwindow.show.size&quot;: &quot;false&quot;,
&quot;last_opened_file_path&quot;: &quot;D:/tuoheng/codenew/tuoheng_alg&quot;,
&quot;node.js.detected.package.eslint&quot;: &quot;true&quot;,
&quot;node.js.detected.package.tslint&quot;: &quot;true&quot;,
&quot;node.js.selected.package.eslint&quot;: &quot;(autodetect)&quot;,
&quot;node.js.selected.package.tslint&quot;: &quot;(autodetect)&quot;,
&quot;project.structure.last.edited&quot;: &quot;SDK&quot;,
&quot;project.structure.proportion&quot;: &quot;0.15&quot;,
&quot;project.structure.side.proportion&quot;: &quot;0.2816092&quot;,
&quot;settings.editor.selected.configurable&quot;: &quot;preferences.pluginManager&quot;,
&quot;vue.rearranger.settings.migration&quot;: &quot;true&quot;
<component name="PropertiesComponent"><![CDATA[{
"keyToString": {
"RunOnceActivity.OpenProjectViewOnStart": "true",
"RunOnceActivity.ShowReadmeOnStart": "true",
"WebServerToolWindowFactoryState": "true",
"WebServerToolWindowPanel.toolwindow.highlight.mappings": "true",
"WebServerToolWindowPanel.toolwindow.highlight.symlinks": "true",
"WebServerToolWindowPanel.toolwindow.show.date": "false",
"WebServerToolWindowPanel.toolwindow.show.permissions": "false",
"WebServerToolWindowPanel.toolwindow.show.size": "false",
"last_opened_file_path": "D:/tuoheng/fanbojiaoyu",
"node.js.detected.package.eslint": "true",
"node.js.detected.package.tslint": "true",
"node.js.selected.package.eslint": "(autodetect)",
"node.js.selected.package.tslint": "(autodetect)",
"project.structure.last.edited": "SDK",
"project.structure.proportion": "0.15",
"project.structure.side.proportion": "0.2816092",
"settings.editor.selected.configurable": "preferences.pluginManager",
"vue.rearranger.settings.migration": "true"
}
}</component>
}]]></component>
<component name="RecentsManager">
<key name="CopyFile.RECENT_KEYS">
<recent name="D:\tuoheng\codenew\tuoheng_alg\test\color" />
<recent name="D:\tuoheng\codenew\tuoheng_alg\test\cuda" />
<recent name="D:\tuoheng\codenew\tuoheng_alg\util" />
<recent name="D:\tuoheng\codenew\tuoheng_alg\test" />
<recent name="D:\tuoheng\codenew\tuoheng_alg\test\aliyun" />
<recent name="D:\tuoheng\codenew\tuoheng_alg\enums" />
</key>
<key name="MoveFile.RECENT_KEYS">
<recent name="D:\tuoheng\codenew\tuoheng_alg\font" />
@@ -168,7 +163,7 @@
<recent name="D:\work\alg\tuoheng_alg\image" />
</key>
</component>
<component name="RunManager" selected="Python.test (2)">
<component name="RunManager" selected="Python.color_test">
<configuration name="IntelligentRecognitionProcess" type="PythonConfigurationType" factoryName="Python" temporary="true" nameIsGenerated="true">
<module name="tuoheng_alg" />
<option name="INTERPRETER_OPTIONS" value="" />
@@ -191,20 +186,20 @@
<option name="INPUT_FILE" value="" />
<method v="2" />
</configuration>
<configuration name="editImage" type="PythonConfigurationType" factoryName="Python" nameIsGenerated="true">
<configuration name="color_test" type="PythonConfigurationType" factoryName="Python" temporary="true" nameIsGenerated="true">
<module name="tuoheng_alg" />
<option name="INTERPRETER_OPTIONS" value="" />
<option name="PARENT_ENVS" value="true" />
<envs>
<env name="PYTHONUNBUFFERED" value="1" />
</envs>
<option name="SDK_HOME" value="$PROJECT_DIR$/../../../software/anaconda/envs/test/python.exe" />
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$/test/editimage" />
<option name="IS_MODULE_SDK" value="false" />
<option name="SDK_HOME" value="" />
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$/test/color" />
<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$/test/editimage/editImage.py" />
<option name="SCRIPT_NAME" value="$PROJECT_DIR$/test/color/color_test.py" />
<option name="PARAMETERS" value="" />
<option name="SHOW_COMMAND_LINE" value="false" />
<option name="EMULATE_TERMINAL" value="false" />
@@ -213,20 +208,20 @@
<option name="INPUT_FILE" value="" />
<method v="2" />
</configuration>
<configuration name="mysqltest" type="PythonConfigurationType" factoryName="Python" nameIsGenerated="true">
<configuration name="editImage" type="PythonConfigurationType" factoryName="Python" nameIsGenerated="true">
<module name="tuoheng_alg" />
<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$/test" />
<option name="IS_MODULE_SDK" value="true" />
<option name="SDK_HOME" value="$PROJECT_DIR$/../../../software/anaconda/envs/test/python.exe" />
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$/test/editimage" />
<option name="IS_MODULE_SDK" value="false" />
<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$/test/mysqltest.py" />
<option name="SCRIPT_NAME" value="$PROJECT_DIR$/test/editimage/editImage.py" />
<option name="PARAMETERS" value="" />
<option name="SHOW_COMMAND_LINE" value="false" />
<option name="EMULATE_TERMINAL" value="false" />
@@ -235,7 +230,7 @@
<option name="INPUT_FILE" value="" />
<method v="2" />
</configuration>
<configuration name="test (1)" type="PythonConfigurationType" factoryName="Python" temporary="true" nameIsGenerated="true">
<configuration name="mysqltest" type="PythonConfigurationType" factoryName="Python" nameIsGenerated="true">
<module name="tuoheng_alg" />
<option name="INTERPRETER_OPTIONS" value="" />
<option name="PARENT_ENVS" value="true" />
@@ -243,12 +238,12 @@
<env name="PYTHONUNBUFFERED" value="1" />
</envs>
<option name="SDK_HOME" value="" />
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$/test/cuda" />
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$/test" />
<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$/test/cuda/test.py" />
<option name="SCRIPT_NAME" value="$PROJECT_DIR$/test/mysqltest.py" />
<option name="PARAMETERS" value="" />
<option name="SHOW_COMMAND_LINE" value="false" />
<option name="EMULATE_TERMINAL" value="false" />
@@ -326,19 +321,19 @@
<list>
<item itemvalue="Python.editImage" />
<item itemvalue="Python.mysqltest" />
<item itemvalue="Python.color_test" />
<item itemvalue="Python.test (2)" />
<item itemvalue="Python.IntelligentRecognitionProcess" />
<item itemvalue="Python.test" />
<item itemvalue="Python.test1" />
<item itemvalue="Python.test (1)" />
</list>
<recent_temporary>
<list>
<item itemvalue="Python.color_test" />
<item itemvalue="Python.test (2)" />
<item itemvalue="Python.IntelligentRecognitionProcess" />
<item itemvalue="Python.test" />
<item itemvalue="Python.test1" />
<item itemvalue="Python.test (1)" />
</list>
</recent_temporary>
</component>
@@ -492,7 +487,9 @@
<workItem from="1683244481879" duration="9171000" />
<workItem from="1683332505792" duration="23325000" />
<workItem from="1683506530261" duration="919000" />
<workItem from="1683507482567" duration="1422000" />
<workItem from="1683507482567" duration="15434000" />
<workItem from="1683591783960" duration="1186000" />
<workItem from="1683677260592" duration="8827000" />
</task>
<servers />
</component>
@@ -541,41 +538,23 @@
<select />
</component>
<component name="com.intellij.coverage.CoverageDataManagerImpl">
<SUITE FILE_PATH="coverage/tuoheng_alg$voddemo.coverage" NAME="voddemo 覆盖结果" MODIFIED="1681722102430" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="true" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$/test/aliyun" />
<SUITE FILE_PATH="coverage/tuoheng_alg___$producer_start.coverage" NAME="producer_start 覆盖结果" MODIFIED="1668522825199" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="true" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="/home/thsw/chenyukun/algSch" />
<SUITE FILE_PATH="coverage/tuoheng_alg$color_test.coverage" NAME="color_test 覆盖结果" MODIFIED="1683683775604" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="true" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$/test/color" />
<SUITE FILE_PATH="coverage/tuoheng_alg$demo1.coverage" NAME="demo1 覆盖结果" MODIFIED="1680162882599" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="true" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$/test/demo" />
<SUITE FILE_PATH="coverage/tuoheng_alg$ffmpeg33.coverage" NAME="ffmpeg33 覆盖结果" MODIFIED="1670489109246" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="true" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$/test/ffmpeg11" />
<SUITE FILE_PATH="coverage/tuoheng_alg___$producer_start1.coverage" NAME="producer_start1 覆盖结果" MODIFIED="1668437822632" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="true" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="/home/thsw/chenyukun/algSch/test/kafka" />
<SUITE FILE_PATH="coverage/tuoheng_alg$minio.coverage" NAME="minio 覆盖结果" MODIFIED="1667465702864" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="true" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$/test/minio1" />
<SUITE FILE_PATH="coverage/tuoheng_alg$producer_start__1_.coverage" NAME="producer_start (1) 覆盖结果" MODIFIED="1665832569996" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="true" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$/test" />
<SUITE FILE_PATH="coverage/tuoheng_alg$3.coverage" NAME="视频添加文字水印3 Coverage Results" MODIFIED="1661906152928" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="true" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$/test" />
<SUITE FILE_PATH="coverage/tuoheng_alg___$ffmpeg11.coverage" NAME="ffmpeg11 覆盖结果" MODIFIED="1668410004435" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="true" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$/test/ffmpeg11" />
<SUITE FILE_PATH="coverage/tuoheng_alg$ffmpeg12.coverage" NAME="ffmpeg12 覆盖结果" MODIFIED="1675391366890" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="true" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$/test/ffmpeg11" />
<SUITE FILE_PATH="coverage/tuoheng_alg$producer_start.coverage" NAME="producer_start1 覆盖结果" MODIFIED="1670999187123" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="true" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$/test/kafka" />
<SUITE FILE_PATH="coverage/tuoheng_alg$Test__2_.coverage" NAME="Test (2) 覆盖结果" MODIFIED="1681796501563" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="true" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$/test/路径" />
<SUITE FILE_PATH="coverage/tuoheng_alg$test1.coverage" NAME="test1 覆盖结果" MODIFIED="1681988279624" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="true" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$/test/cuda" />
<SUITE FILE_PATH="coverage/tuoheng_alg$ossdemo.coverage" NAME="ossdemo 覆盖结果" MODIFIED="1681715255761" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="true" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$/test/aliyun" />
<SUITE FILE_PATH="coverage/tuoheng_alg$test__1_.coverage" NAME="test (1) 覆盖结果" MODIFIED="1681969578447" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="true" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$/test/cuda" />
<SUITE FILE_PATH="coverage/tuoheng_alg$aa1.coverage" NAME="aa1 覆盖结果" MODIFIED="1667351136888" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="true" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$/test/ffmpeg11" />
<SUITE FILE_PATH="coverage/tuoheng_alg$.coverage" NAME="协程笔记 覆盖结果" MODIFIED="1680926972744" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="true" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$/test/协程" />
<SUITE FILE_PATH="coverage/tuoheng_alg$4.coverage" NAME="视频添加图片水印4 Coverage Results" MODIFIED="1661874731395" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="true" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$/test" />
<SUITE FILE_PATH="coverage/tuoheng_alg$gputest.coverage" NAME="gputest 覆盖结果" MODIFIED="1681950938970" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="true" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$/test/gpu" />
<SUITE FILE_PATH="coverage/tuoheng_alg___$test.coverage" NAME="test 覆盖结果" MODIFIED="1668577200259" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="true" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$/test/while" />
<SUITE FILE_PATH="coverage/tuoheng_alg$1.coverage" NAME="协程1 覆盖结果" MODIFIED="1667866542122" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="true" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$/test/协程" />
<SUITE FILE_PATH="coverage/tuoheng_alg___$3.coverage" NAME="协程3 覆盖结果" MODIFIED="1668147029048" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="true" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$/test/协程" />
<SUITE FILE_PATH="coverage/tuoheng_alg$asnyc.coverage" NAME="asnyc Coverage Results" MODIFIED="1663459033435" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="true" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$/test" />
<SUITE FILE_PATH="coverage/tuoheng_alg$5.coverage" NAME="视频添加图片水印5 Coverage Results" MODIFIED="1661905982885" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="true" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$/test" />
<SUITE FILE_PATH="coverage/tuoheng_alg$editImage.coverage" NAME="editImage 覆盖结果" MODIFIED="1678348350574" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="true" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$/test/editimage" />
<SUITE FILE_PATH="coverage/tuoheng_alg$read.coverage" NAME="read Coverage Results" MODIFIED="1663640070956" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="true" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$/test" />
<SUITE FILE_PATH="coverage/tuoheng_alg$cv2test1__1_.coverage" NAME="cv2test1 覆盖结果" MODIFIED="1665820653649" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="true" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$/test" />
<SUITE FILE_PATH="coverage/tuoheng_alg$TimeUtils.coverage" NAME="TimeUtils Coverage Results" MODIFIED="1661222768678" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="true" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$/util" />
<SUITE FILE_PATH="coverage/tuoheng_alg$2.coverage" NAME="协程2 覆盖结果" MODIFIED="1668066168428" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="true" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="/opt/tuo_heng/algSch/test/协程/" />
<SUITE FILE_PATH="coverage/tuoheng_alg$producer_start1.coverage" NAME="producer_start1 覆盖结果" MODIFIED="1671428635702" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="true" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$/test/kafka" />
<SUITE FILE_PATH="coverage/tuoheng_alg$ImgBaiduSdk.coverage" NAME="ImgBaiduSdk 覆盖结果" MODIFIED="1678355024003" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="true" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$/util" />
<SUITE FILE_PATH="coverage/tuoheng_alg$ImageUtils.coverage" NAME="ImageUtils Coverage Results" MODIFIED="1663499421253" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="true" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$/util" />
<SUITE FILE_PATH="coverage/tuoheng_alg___$producer_stop.coverage" NAME="producer_stop 覆盖结果" MODIFIED="1668522920533" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="true" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="/home/thsw/chenyukun/algSch" />
<SUITE FILE_PATH="coverage/tuoheng_alg$dsp_master.coverage" NAME="dsp_master 覆盖结果" MODIFIED="1680503755624" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="true" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$" />
<SUITE FILE_PATH="coverage/tuoheng_alg$Test__1_.coverage" NAME="Test (1) 覆盖结果" MODIFIED="1681199611277" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="true" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$/test/线程" />
<SUITE FILE_PATH="coverage/tuoheng_alg$test.coverage" NAME="test 覆盖结果" MODIFIED="1682582986112" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="true" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$/test/集合" />
<SUITE FILE_PATH="coverage/tuoheng_alg$IntelligentRecognitionProcess.coverage" NAME="IntelligentRecognitionProcess 覆盖结果" MODIFIED="1682651444560" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="true" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$/concurrency" />
<SUITE FILE_PATH="coverage/tuoheng_alg$Test.coverage" NAME="Test 覆盖结果" MODIFIED="1681810213173" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="true" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$/test/序列化" />
@@ -586,6 +565,25 @@
<SUITE FILE_PATH="coverage/tuoheng_alg$aa.coverage" NAME="aa 覆盖结果" MODIFIED="1670490313339" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="true" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="/home/chenyukun/algSch/test/ffmpeg11" />
<SUITE FILE_PATH="coverage/tuoheng_alg$ffmpeg22.coverage" NAME="aa 覆盖结果" MODIFIED="1667350492259" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="true" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="/opt/tuo_heng" />
<SUITE FILE_PATH="coverage/tuoheng_alg$KafkaUtils__1_.coverage" NAME="KafkaUtils (1) Coverage Results" MODIFIED="1663464961001" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="true" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$/util" />
<SUITE FILE_PATH="coverage/tuoheng_alg$voddemo.coverage" NAME="voddemo 覆盖结果" MODIFIED="1681722102430" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="true" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$/test/aliyun" />
<SUITE FILE_PATH="coverage/tuoheng_alg___$producer_start.coverage" NAME="producer_start 覆盖结果" MODIFIED="1668522825199" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="true" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="/home/thsw/chenyukun/algSch" />
<SUITE FILE_PATH="coverage/tuoheng_alg___$producer_start1.coverage" NAME="producer_start1 覆盖结果" MODIFIED="1668437822632" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="true" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="/home/thsw/chenyukun/algSch/test/kafka" />
<SUITE FILE_PATH="coverage/tuoheng_alg$producer_start__1_.coverage" NAME="producer_start (1) 覆盖结果" MODIFIED="1665832569996" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="true" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$/test" />
<SUITE FILE_PATH="coverage/tuoheng_alg___$ffmpeg11.coverage" NAME="ffmpeg11 覆盖结果" MODIFIED="1668410004435" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="true" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$/test/ffmpeg11" />
<SUITE FILE_PATH="coverage/tuoheng_alg$producer_start.coverage" NAME="producer_start1 覆盖结果" MODIFIED="1670999187123" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="true" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$/test/kafka" />
<SUITE FILE_PATH="coverage/tuoheng_alg$.coverage" NAME="协程笔记 覆盖结果" MODIFIED="1680926972744" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="true" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$/test/协程" />
<SUITE FILE_PATH="coverage/tuoheng_alg$4.coverage" NAME="视频添加图片水印4 Coverage Results" MODIFIED="1661874731395" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="true" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$/test" />
<SUITE FILE_PATH="coverage/tuoheng_alg$gputest.coverage" NAME="gputest 覆盖结果" MODIFIED="1681950938970" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="true" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$/test/gpu" />
<SUITE FILE_PATH="coverage/tuoheng_alg$1.coverage" NAME="协程1 覆盖结果" MODIFIED="1667866542122" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="true" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$/test/协程" />
<SUITE FILE_PATH="coverage/tuoheng_alg___$3.coverage" NAME="协程3 覆盖结果" MODIFIED="1668147029048" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="true" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$/test/协程" />
<SUITE FILE_PATH="coverage/tuoheng_alg$asnyc.coverage" NAME="asnyc Coverage Results" MODIFIED="1663459033435" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="true" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$/test" />
<SUITE FILE_PATH="coverage/tuoheng_alg$5.coverage" NAME="视频添加图片水印5 Coverage Results" MODIFIED="1661905982885" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="true" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$/test" />
<SUITE FILE_PATH="coverage/tuoheng_alg$read.coverage" NAME="read Coverage Results" MODIFIED="1663640070956" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="true" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$/test" />
<SUITE FILE_PATH="coverage/tuoheng_alg$cv2test1__1_.coverage" NAME="cv2test1 覆盖结果" MODIFIED="1665820653649" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="true" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$/test" />
<SUITE FILE_PATH="coverage/tuoheng_alg$TimeUtils.coverage" NAME="TimeUtils Coverage Results" MODIFIED="1661222768678" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="true" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$/util" />
<SUITE FILE_PATH="coverage/tuoheng_alg$producer_start1.coverage" NAME="producer_start1 覆盖结果" MODIFIED="1671428635702" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="true" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$/test/kafka" />
<SUITE FILE_PATH="coverage/tuoheng_alg___$producer_stop.coverage" NAME="producer_stop 覆盖结果" MODIFIED="1668522920533" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="true" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="/home/thsw/chenyukun/algSch" />
<SUITE FILE_PATH="coverage/tuoheng_alg$Test__1_.coverage" NAME="Test (1) 覆盖结果" MODIFIED="1681199611277" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="true" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$/test/线程" />
<SUITE FILE_PATH="coverage/tuoheng_alg$ffmpeg13.coverage" NAME="ffmpeg13 覆盖结果" MODIFIED="1675394160900" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="true" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$/test/ffmpeg11" />
<SUITE FILE_PATH="coverage/tuoheng_alg$KafkaUtils.coverage" NAME="KafkaUtils Coverage Results" MODIFIED="1663465345491" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="true" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$/util" />
<SUITE FILE_PATH="coverage/tuoheng_alg$test__2_.coverage" NAME="test (2) 覆盖结果" MODIFIED="1683355406740" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="true" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$/test/进程" />

+ 22
- 0
common/Constant.py View File

@@ -11,3 +11,25 @@ success_progess = "1.0000"

# 拉流每帧图片缩小宽度大小限制, 大于1400像素缩小一半, 小于1400像素不变
width = 1400

COLOR = [
[0, 0, 255],
[255, 0, 0],
[211, 0, 148],
[0, 127, 0],
[0, 69, 255],
[0, 255, 0],
[255, 0, 255],
[0, 0, 127],
[127, 0, 255],
[255, 129, 0],
[139, 139, 0],
[255, 255, 0],
[127, 255, 0],
[0, 127, 255],
[0, 255, 127],
[255, 127, 255],
[8, 101, 139],
[171, 130, 255],
[139, 112, 74],
[205, 205, 180]]

+ 134
- 0
common/YmlConstant.py View File

@@ -158,3 +158,137 @@ def get_kafka_results_topic(context):

def get_kafka_recording_result_topic(context):
return context["kafka"]["topic"]["dsp-recording-result-topic"]


def get_aliyun_access_key(context):
return context["aliyun"]["access_key"]


def get_aliyun_access_secret(context):
return context["aliyun"]["access_secret"]


def get_aliyun_oss_endpoint(context):
return context["aliyun"]["oss"]["endpoint"]


def get_aliyun_oss_bucket(context):
return context["aliyun"]["oss"]["bucket"]


def get_aliyun_oss_connect_timeout(context):
return context["aliyun"]["oss"]["connect_timeout"]


def get_aliyun_vod_ecsRegionId(context):
return context["aliyun"]["vod"]["ecsRegionId"]


def get_aliyun_vod_cateId(context):
return context["aliyun"]["vod"][context["dsp"]["active"]]["CateId"]


def get_gpu_order(context):
return context["gpu"]["order"]


def get_gpu_limit(context):
return context["gpu"]["limit"]


def get_gpu_maxLoad(context):
return context["gpu"]["maxLoad"]


def get_gpu_maxMemory(context):
return context["gpu"]["maxMemory"]


def get_gpu_includeNan(context):
return context["gpu"]["includeNan"]


def get_gpu_excludeID(context):
return context["gpu"]["excludeID"]


def get_gpu_excludeUUID(context):
return context["gpu"]["excludeUUID"]


def get_baidu_vehicle_APP_ID(context):
return context["baidu"]["vehicle"]["APP_ID"]


def get_baidu_vehicle_API_KEY(context):
return context["baidu"]["vehicle"]["API_KEY"]


def get_baidu_vehicle_SECRET_KEY(context):
return context["baidu"]["vehicle"]["SECRET_KEY"]


def get_baidu_person_APP_ID(context):
return context["baidu"]["person"]["APP_ID"]


def get_baidu_person_API_KEY(context):
return context["baidu"]["person"]["API_KEY"]


def get_baidu_person_SECRET_KEY(context):
return context["baidu"]["person"]["SECRET_KEY"]


def get_baidu_ocr_APP_ID(context):
return context["baidu"]["orc"]["APP_ID"]


def get_baidu_ocr_API_KEY(context):
return context["baidu"]["orc"]["API_KEY"]


def get_baidu_ocr_SECRET_KEY(context):
return context["baidu"]["orc"]["SECRET_KEY"]


def get_log_base_path(context):
return context["log"]["base_path"]


def get_log_enable_file(context):
return context["log"]["enable_file_log"]


def get_log_log_name(context):
return context["log"]["log_name"]


def get_log_rotation(context):
return context["log"]["rotation"]


def get_log_retention(context):
return context["log"]["retention"]


def get_log_log_fmt(context):
return context["log"]["log_fmt"]


def get_log_level(context):
return context["log"]["level"]


def get_log_enqueue(context):
return context["log"]["enqueue"]


def get_log_encoding(context):
return context["log"]["encoding"]


def get_log_enable_stderr(context):
return context["log"]["enable_stderr"]



+ 35
- 6
concurrency/IntelligentRecognitionProcess.py View File

@@ -433,6 +433,12 @@ class OnlineIntelligentRecognitionProcess(IntelligentRecognitionProcess):
ExceptionType.SERVICE_INNER_EXCEPTION.value[1],
analyse_time=TimeUtils.now_date_to_str())}
finally:
if ttt:
ttt.shutdown(False)
if tt:
tt.shutdown(False)
if t:
t.shutdown(False)
if cv2tool:
cv2tool.close()
if pullProcess is not None and pullProcess.is_alive():
@@ -577,6 +583,12 @@ class OfflineIntelligentRecognitionProcess(IntelligentRecognitionProcess):
ExceptionType.SERVICE_INNER_EXCEPTION.value[1],
analyse_time=TimeUtils.now_date_to_str())}
finally:
if ttt:
ttt.shutdown(False)
if tt:
tt.shutdown(False)
if t:
t.shutdown(False)
if cv2tool is not None:
cv2tool.close()
if pullProcess is not None and pullProcess.is_alive():
@@ -609,23 +621,38 @@ class PhotosIntelligentRecognitionProcess(IntelligentRecognitionProcess):
if dataBack is None or dataBack.get("plateImage") is None or len(dataBack.get("plateImage")) == 0:
result = orc.license_plate_recognition(image, self.msg.get("request_id"))
score = ''
if result is None or result.get("words_result") is None:
if result is None or result.get("words_result") is None or len(result.get("words_result")) == 0:
logger.error("车牌识别为空: {}", result)
carCode = ''
else:
carCode = result.get("words_result").get("number")
for word in result.get("words_result"):
if word is not None and word.get("number") is not None:
if len(carCode) == 0:
carCode = word.get("number")
else:
carCode = carCode + "," + word.get("number")
else:
result = orc.license_plate_recognition(dataBack.get("plateImage")[0], self.msg.get("request_id"))
score = dataBack.get("plateImage")[1]
if result is None or result.get("words_result") is None:
if result is None or result.get("words_result") is None or len(result.get("words_result")) == 0:
result = orc.license_plate_recognition(image, self.msg.get("request_id"))
if result is None or result.get("words_result") is None:
if result is None or result.get("words_result") is None or len(result.get("words_result")) == 0:
logger.error("车牌识别为空: {}", result)
carCode = ''
else:
carCode = result.get("words_result").get("number")
for word in result.get("words_result"):
if word is not None and word.get("number") is not None:
if len(carCode) == 0:
carCode = word.get("number")
else:
carCode = carCode + "," + word.get("number")
else:
carCode = result.get("words_result").get("number")
for word in result.get("words_result"):
if word is not None and word.get("number") is not None:
if len(carCode) == 0:
carCode = word.get("number")
else:
carCode = carCode + "," + word.get("number")
if len(carCode) > 0:
plate_result = {'type': str(3), 'modelCode': model_type_code, 'carUrl': imageUrl,
'carCode': carCode,
@@ -1236,6 +1263,8 @@ class ScreenRecordingProcess(Process):
ExceptionType.SERVICE_INNER_EXCEPTION.value[0],
ExceptionType.SERVICE_INNER_EXCEPTION.value[1])}
finally:
if t:
t.shutdown(False)
if cv2tool:
cv2tool.close()
if hb:

+ 0
- 3
concurrency/PullStreamThread.py View File

@@ -3,12 +3,9 @@ import time
from queue import Queue
from threading import Thread

import GPUtil
from loguru import logger

from entity.FeedBack import recording_feedback
from enums.ExceptionEnum import ExceptionType
from enums.RecordingStatusEnum import RecordingStatus
from exception.CustomerException import ServiceException
from util import GPUtils
from util.Cv2Utils import Cv2Util

+ 0
- 43
config/ModelConfig.py View File

@@ -1,43 +0,0 @@
# -*- coding: utf-8 -*-
import sys

sys.path.extend(['..', '../AIlib'])
from segutils.segmodel import SegModel, get_largest_contours
from utils.torch_utils import select_device
from models.experimental import attempt_load
from utilsK.queRiver import get_labelnames, get_label_arrays, post_process_
from AI import AI_process, AI_process_forest, get_postProcess_para


class ModelConfig():
def __init__(self):
postFile = '../AIlib/conf/para.json'
self.conf_thres, self.iou_thres, self.classes, self.rainbows = get_postProcess_para(postFile)


class SZModelConfig(ModelConfig):

def __init__(self):
super(SZModelConfig, self).__init__()
labelnames = "../AIlib/weights/yolov5/class8/labelnames.json" ##对应类别表
self.names = get_labelnames(labelnames)
self.label_arraylist = get_label_arrays(self.names, self.rainbows, outfontsize=40,
fontpath="../AIlib/conf/platech.ttf")


class LCModelConfig(ModelConfig):
def __init__(self):
super(LCModelConfig, self).__init__()
labelnames = "../AIlib/weights/forest/labelnames.json"
self.names = get_labelnames(labelnames)
self.label_arraylist = get_label_arrays(self.names, self.rainbows, outfontsize=40, fontpath="../AIlib/conf/platech.ttf")


class RFModelConfig(ModelConfig):
def __init__(self):
super(RFModelConfig, self).__init__()
labelnames = "../AIlib/weights/road/labelnames.json"
self.names = get_labelnames(labelnames)
imageW = 1536
outfontsize=int(imageW/1920*40)
self.label_arraylist = get_label_arrays(self.names, self.rainbows, outfontsize=outfontsize, fontpath="../AIlib/conf/platech.ttf")

+ 0
- 0
test/color/__init__.py View File


+ 73
- 0
test/color/color_test.py View File

@@ -0,0 +1,73 @@

import cv2
import numpy as np
from PIL import Image, ImageDraw, ImageFont

rainbows = [
[0, 0, 255],
[255, 0, 0],
[211, 0, 148],
[0, 127, 0],
[0, 69, 255],
[0, 255, 0],
[255, 0, 255],
[0, 0, 127],
[127, 0, 255],
[255, 129, 0],
[139, 139, 0],
[255, 255, 0],
[127, 255, 0],
[0, 127, 255],
[0, 255, 127],
[255, 127, 255],
[8, 101, 139],
[171, 130, 255],
[139, 112, 74],
[205, 205, 180]]
# rainbows = [[0, 0, 255],
# [211, 0, 148],
# [0, 69, 255],
# [133, 21, 199],
# [0, 100, 0],
# [34, 139, 34],
# [8, 101, 139],
# [11, 134, 184],
# [92, 92, 205],
# [147, 20, 255],
# [255, 0, 255],
# [96, 48, 176],
# [205, 205, 105],
# [139, 139, 102],
# [255, 245, 0],
# [170, 205, 102],
# [155, 205, 155],
# [0, 205, 0],
# [79, 79, 47],
# [105, 105, 105],
# [112, 25, 25],
# [205, 0, 0],
# ]


def get_label_array(color=None, label=None, font=None, fontSize=40):
x, y, width, height = font.getbbox(label)
text_image = np.zeros((height, width, 3), dtype=np.uint8)
text_image = Image.fromarray(text_image)
draw = ImageDraw.Draw(text_image)
draw.rectangle((0, 0, width, height), fill=tuple(color))
draw.text((0, -3), label, fill=(255, 255, 255), font=font)
im_array = np.asarray(text_image)
scale = fontSize / height
im_array = cv2.resize(im_array, (0, 0), fx=scale, fy=scale)
return im_array


if __name__ == '__main__':
font = ImageFont.truetype('platech.ttf', 40, encoding='utf-8')
im_arrays = []
for color in rainbows:
im_array = get_label_array(color=color, label="植被", font=font, fontSize=40)
im_arrays.append(im_array)
frame_merge = np.hstack(tuple(im_arrays))
cv2.imshow('frame1', frame_merge)
cv2.waitKey(10000000)

BIN
test/color/platech.ttf View File


+ 46
- 43
util/AliyunSdk.py View File

@@ -1,5 +1,10 @@
# -*- coding: utf-8 -*-
import oss2
import time

from aliyunsdkvod.request.v20170321.GetPlayInfoRequest import GetPlayInfoRequest

from common import YmlConstant
from exception.CustomerException import ServiceException
from enums.ExceptionEnum import ExceptionType
import json
@@ -10,113 +15,112 @@ from voduploadsdk.AliyunVodUploader import AliyunVodUploader
from voduploadsdk.UploadVideoRequest import UploadVideoRequest


class AliyunOssSdk():
class AliyunOssSdk:

def __init__(self, content, logger, requestId):
self.content = content
def __init__(self, context, log, requestId):
self.__context = context
self.bucket = None
self.logger = logger
self.requestId = requestId
self.__logger = log
self.__requestId = requestId

def get_oss_bucket(self):
if self.bucket is None:
self.logger.info("初始化oss桶, requestId:{}", self.requestId)
auth = oss2.Auth(self.content["aliyun"]["access_key"], self.content["aliyun"]["access_secret"])
self.bucket = oss2.Bucket(auth,
self.content["aliyun"]["oss"]["endpoint"],
self.content["aliyun"]["oss"]["bucket"],
connect_timeout=self.content["aliyun"]["oss"]["connect_timeout"])
self.__logger.info("初始化oss桶, requestId:{}", self.__requestId)
auth = oss2.Auth(YmlConstant.get_aliyun_access_key(self.__context),
YmlConstant.get_aliyun_access_secret(self.__context))
self.bucket = oss2.Bucket(auth, YmlConstant.get_aliyun_oss_endpoint(self.__context),
YmlConstant.get_aliyun_oss_bucket(self.__context),
connect_timeout=YmlConstant.get_aliyun_oss_connect_timeout(self.__context))

def sync_upload_file(self, updatePath, fileByte):
self.logger.info("开始上传文件到oss, requestId:{}", self.requestId)
self.__logger.info("开始上传文件到oss, requestId:{}", self.__requestId)
self.get_oss_bucket()
MAX_RETRIES = 3
retry_count = 0
while True:
try:
self.bucket.put_object(updatePath, fileByte)
self.logger.info("上传文件到oss成功! requestId:{}", self.requestId)
self.__logger.info("上传文件到oss成功! requestId:{}", self.__requestId)
break
except Exception as e:
retry_count += 1
time.sleep(1)
self.logger.info("上传文件到oss失败, 重试次数:{}, requestId:{}", retry_count, self.requestId)
self.__logger.info("上传文件到oss失败, 重试次数:{}, requestId:{}", retry_count, self.__requestId)
if retry_count > MAX_RETRIES:
self.logger.exception("上传文件到oss重试失败:{}, requestId:{}", e, self.requestId)
self.__logger.exception("上传文件到oss重试失败:{}, requestId:{}", e, self.__requestId)
raise e


class ThAliyunVodSdk():
class ThAliyunVodSdk:

def __init__(self, content, logger, requestId):
self.content = content
self.logger = logger
self.requestId = requestId
def __init__(self, context, log, requestId):
self.__context = context
self.__logger = log
self.__requestId = requestId

def init_vod_client(self, accessKeyId, accessKeySecret):
regionId = self.content["aliyun"]["vod"]["ecsRegionId"]
regionId = YmlConstant.get_aliyun_vod_ecsRegionId(self.__context)
return AcsClient(accessKeyId, accessKeySecret, regionId, auto_retry=True, max_retry_time=3, timeout=30)

def get_play_info(self, videoId):
self.logger.info("开始获取视频地址,videoId:{}, requestId:{}", videoId, self.requestId)
self.__logger.info("开始获取视频地址,videoId:{}, requestId:{}", videoId, self.__requestId)
start = time.time()
while True:
try:
clt = self.init_vod_client(self.content["aliyun"]["access_key"],
self.content["aliyun"]["access_secret"])
request = GetPlayInfoRequest.GetPlayInfoRequest()
clt = self.init_vod_client(YmlConstant.get_aliyun_access_key(self.__context),
YmlConstant.get_aliyun_access_secret(self.__context))
request: GetPlayInfoRequest = GetPlayInfoRequest.GetPlayInfoRequest()
request.set_accept_format('JSON')
request.set_VideoId(videoId)
request.set_AuthTimeout(3600 * 5)
response = json.loads(clt.do_action_with_exception(request))
play_url = response["PlayInfoList"]["PlayInfo"][0]["PlayURL"]
self.logger.info("获取视频地址成功,视频地址: {}, requestId: {}", play_url, self.requestId)
self.__logger.info("获取视频地址成功,视频地址: {}, requestId: {}", play_url, self.__requestId)
return play_url
except Exception as e:
self.logger.error("获取视频地址失败,5秒后重试, requestId: {}", self.requestId)
self.__logger.error("获取视频地址失败,5秒后重试, requestId: {}", self.__requestId)
time.sleep(5)
current_time = time.time()
if "HTTP Status: 403" not in str(e):
self.logger.exception("获取视频地址失败: {}, requestId: {}", e, self.requestId)
self.__logger.exception("获取视频地址失败: {}, requestId: {}", e, self.__requestId)
raise ServiceException(ExceptionType.GET_VIDEO_URL_EXCEPTION.value[0],
ExceptionType.GET_VIDEO_URL_EXCEPTION.value[1])
if "HTTP Status: 403" in str(e) and ("UploadFail" in str(e) or "TranscodeFail" in str(e)):
self.logger.exception("获取视频地址失败: {}, requestId: {}", e, self.requestId)
self.__logger.exception("获取视频地址失败: {}, requestId: {}", e, self.__requestId)
raise ServiceException(ExceptionType.GET_VIDEO_URL_EXCEPTION.value[0],
ExceptionType.GET_VIDEO_URL_EXCEPTION.value[1])
diff_time = current_time - start
if diff_time > 60 * 60 * 2:
self.logger.exception("获取视频地址失败超时异常: {},超时时间:{}, requestId: {}", e, diff_time,
self.requestId)
self.__logger.exception("获取视频地址失败超时异常: {},超时时间:{}, requestId: {}", e, diff_time,
self.__requestId)
raise ServiceException(ExceptionType.GET_VIDEO_URL_TIMEOUT_EXCEPTION.value[0],
ExceptionType.GET_VIDEO_URL_TIMEOUT_EXCEPTION.value[1])

def upload_local_video(self, filePath, file_title, storageLocation=None):
self.logger.info("开始执行vod视频上传, filePath: {}, requestId: {}", filePath, self.requestId)
uploader = AliyunVodUploader(self.content["aliyun"]["access_key"], self.content["aliyun"]["access_secret"])
uploadVideoRequest = UploadVideoRequest(filePath, file_title)
self.logger.info("视频分类:{}", self.content["aliyun"]["vod"][self.content["dsp"]["active"]]["CateId"])
uploadVideoRequest.setCateId(self.content["aliyun"]["vod"][self.content["dsp"]["active"]]["CateId"])
def upload_local_video(self, filePath, file_title):
self.__logger.info("开始执行vod视频上传, filePath: {}, requestId: {}", filePath, self.__requestId)
uploader = AliyunVodUploader(YmlConstant.get_aliyun_access_key(self.__context),
YmlConstant.get_aliyun_access_secret(self.__context))
uploadVideoRequest: UploadVideoRequest = UploadVideoRequest(filePath, file_title)
self.__logger.info("视频分类:{}", YmlConstant.get_aliyun_vod_cateId(self.__context))
uploadVideoRequest.setCateId(YmlConstant.get_aliyun_vod_cateId(self.__context))
# 可以设置视频封面,如果是本地或网络图片可使用UploadImageRequest上传图片到视频点播,获取到ImageURL
# ImageURL示例:https://example.com/sample-****.jpg
# uploadVideoRequest.setCoverURL('<your Image URL>')
# 标签
# uploadVideoRequest.setTags('tag1,tag2')
if storageLocation:
uploadVideoRequest.setStorageLocation(storageLocation)
MAX_RETRIES = 3
retry_count = 0
while True:
try:
result = uploader.uploadLocalVideo(uploadVideoRequest)
self.logger.info("vod视频上传成功, videoId:{}, requestId:{}", result.get("VideoId"), self.requestId)
self.__logger.info("vod视频上传成功, videoId:{}, requestId:{}", result.get("VideoId"), self.__requestId)
return result.get("VideoId")
except AliyunVodException as e:
retry_count += 1
time.sleep(3)
self.logger.error("vod视频上传失败,重试次数:{}, requestId:{}", retry_count, self.requestId)
self.__logger.error("vod视频上传失败,重试次数:{}, requestId:{}", retry_count, self.__requestId)
if retry_count >= MAX_RETRIES:
self.logger.exception("vod视频上传重试失败: {}, requestId:{}", e.message, self.requestId)
self.__logger.exception("vod视频上传重试失败: {}, requestId:{}", e.message, self.__requestId)
raise ServiceException(ExceptionType.SERVICE_INNER_EXCEPTION.value[0],
ExceptionType.SERVICE_INNER_EXCEPTION.value[1])

@@ -125,4 +129,3 @@ class ThAliyunVodSdk():
if videoId is None or len(videoId) == 0:
return None
return self.get_play_info(videoId)


+ 2
- 2
util/Cv2Utils.py View File

@@ -14,7 +14,7 @@ from enums.ExceptionEnum import ExceptionType

class Cv2Util():

def __init__(self, pullUrl=None, pushUrl=None, orFilePath=None, aiFilePath=None, requestId=None, content=None,
def __init__(self, pullUrl=None, pushUrl=None, orFilePath=None, aiFilePath=None, requestId=None, context=None,
gpu_ids=None, log=logger):
self.pullUrl = pullUrl
self.pushUrl = pushUrl
@@ -38,7 +38,7 @@ class Cv2Util():
self.p_push_retry_num = 0
self.isGpu = False
self.read_w_h = None
self.content = content
self.context = context
if gpu_ids is not None and len(gpu_ids) > 0:
self.isGpu = True


+ 11
- 10
util/GPUtils.py View File

@@ -1,5 +1,6 @@
import GPUtil

from common import YmlConstant
from enums.ExceptionEnum import ExceptionType
from exception.CustomerException import ServiceException

@@ -18,14 +19,14 @@ from exception.CustomerException import ServiceException
# excludeUUIDexcludeID-除了它使用 UUID 之外,其他相同。(默认 = [])
# 输出
# deviceIDs - 所有可用 GPU 设备 ID 的列表。如果当前负载和内存使用量分别小于maxLoad和maxMemory,则认为 GPU 可用。该列表是根据 排序的order。返回的设备 ID 的最大数量由 限制limit。
def get_gpu_ids(content):
deviceIDs = GPUtil.getAvailable(order=content["gpu"]["order"],
limit=int(content["gpu"]["limit"]),
maxLoad=float(content["gpu"]["maxLoad"]),
maxMemory=float(content["gpu"]["maxMemory"]),
includeNan=content["gpu"]["includeNan"],
excludeID=content["gpu"]["excludeID"],
excludeUUID=content["gpu"]["excludeUUID"])
def get_gpu_ids(context):
deviceIDs = GPUtil.getAvailable(order=YmlConstant.get_gpu_order(context),
limit=int(YmlConstant.get_gpu_limit(context)),
maxLoad=float(YmlConstant.get_gpu_maxLoad(context)),
maxMemory=float(YmlConstant.get_gpu_maxMemory(context)),
includeNan=YmlConstant.get_gpu_includeNan(context),
excludeID=YmlConstant.get_gpu_excludeID(context),
excludeUUID=YmlConstant.get_gpu_excludeUUID(context))
return deviceIDs


@@ -40,8 +41,8 @@ def get_first_gpu_name():
return gps[0].name


def check_gpu_resource(content):
gpu_ids = get_gpu_ids(content)
def check_gpu_resource(context):
gpu_ids = get_gpu_ids(context)
if gpu_ids is None or len(gpu_ids) == 0 or (0 not in gpu_ids and str(0) not in gpu_ids):
raise ServiceException(ExceptionType.NO_GPU_RESOURCES.value[0],
ExceptionType.NO_GPU_RESOURCES.value[1])

+ 11
- 10
util/ImgBaiduSdk.py View File

@@ -2,6 +2,7 @@ import time
from aip import AipImageClassify, AipBodyAnalysis
from loguru import logger

from common import YmlConstant
from enums.BaiduSdkEnum import BAIDUERRORDATA
from enums.ExceptionEnum import ExceptionType
from exception.CustomerException import ServiceException
@@ -10,17 +11,17 @@ from util.ImageUtils import url2Content

class AipImageClassifyClient:

def __init__(self, content):
self.__content = content
def __init__(self, context):
self.__context = context
self.__client = None
self.init_client()
# self.lock = Lock()

def init_client(self):
if self.__client is None:
self.__client = AipImageClassify(str(self.__content["baidu"]["vehicle"]["APP_ID"]),
self.__content["baidu"]["vehicle"]["API_KEY"],
self.__content["baidu"]["vehicle"]["SECRET_KEY"])
self.__client = AipImageClassify(str(YmlConstant.get_baidu_vehicle_APP_ID(self.__context)),
YmlConstant.get_baidu_vehicle_API_KEY(self.__context),
YmlConstant.get_baidu_vehicle_SECRET_KEY(self.__context))

'''
车辆检测
@@ -135,17 +136,17 @@ class AipImageClassifyClient:

class AipBodyAnalysisClient:

def __init__(self, content):
self.__content = content
def __init__(self, context):
self.__context = context
self.__client = None
self.init_client()
# self.lock = Lock()

def init_client(self):
if self.__client is None:
self.__client = AipBodyAnalysis(str(self.__content["baidu"]["person"]["APP_ID"]),
self.__content["baidu"]["person"]["API_KEY"],
self.__content["baidu"]["person"]["SECRET_KEY"])
self.__client = AipBodyAnalysis(str(YmlConstant.get_baidu_person_APP_ID(self.__context)),
YmlConstant.get_baidu_person_API_KEY(self.__context),
YmlConstant.get_baidu_person_SECRET_KEY(self.__context))

'''
人体检测与属性识别

+ 17
- 14
util/LogUtils.py View File

@@ -3,26 +3,29 @@ import sys
import os
from loguru import logger

from common import YmlConstant


# 初始化日志配置
def init_log(content):
def init_log(context):
# 判断日志文件是否存在,不存在创建
if not os.path.exists(content["log"]["base_path"]):
os.makedirs(content["log"]["base_path"])
base_path = YmlConstant.get_log_base_path(context)
if not os.path.exists(base_path):
os.makedirs(base_path)
# 移除日志设置
logger.remove(handler_id=None)
# 打印日志到文件
if content["log"]["enable_file_log"]:
logger.add(content["log"]["base_path"] + content["log"]["log_name"],
rotation=content["log"]["rotation"],
retention=content["log"]["retention"],
format=content["log"]["log_fmt"],
level=content["log"]["level"],
enqueue=content["log"]["enqueue"],
encoding=content["log"]["encoding"])
if YmlConstant.get_log_enable_file(context):
logger.add(base_path + YmlConstant.get_log_log_name(context),
rotation=YmlConstant.get_log_rotation(context),
retention=YmlConstant.get_log_retention(context),
format=YmlConstant.get_log_log_fmt(context),
level=YmlConstant.get_log_level(context),
enqueue=YmlConstant.get_log_enqueue(context),
encoding=YmlConstant.get_log_encoding(context))
# 控制台输出
if content["log"]["enable_stderr"]:
if YmlConstant.get_log_enable_stderr(context):
logger.add(sys.stderr,
format=content["log"]["log_fmt"],
level=content["log"]["level"],
format=YmlConstant.get_log_log_fmt(context),
level=YmlConstant.get_log_level(context),
enqueue=True)

+ 13
- 49
util/ModelUtils.py View File

@@ -2,6 +2,7 @@
import copy
import sys

from common.Constant import COLOR
from common.YmlConstant import GPU_NAME
from enums.ExceptionEnum import ExceptionType
from enums.ModelTypeEnum import ModelType, BAIDU_MODEL_TARGET_CONFIG
@@ -229,10 +230,7 @@ class RiverModel:
"conf_thres": 0.25,
"iou_thres": 0.45,
"classes": 5,
"rainbows": [[0, 0, 255], [0, 255, 0], [255, 0, 0], [255, 0, 255], [255, 255, 0], [255, 129, 0],
[255, 0, 127], [127, 255, 0], [0, 255, 127], [0, 127, 255], [127, 0, 255],
[255, 127, 255], [255, 255, 127], [127, 255, 255], [0, 255, 255], [255, 127, 255],
[127, 255, 255], [0, 127, 0], [0, 0, 127], [0, 255, 255]]
"rainbows": COLOR
}
}
if self.trtFlag_det and self.trtFlag_seg:
@@ -375,11 +373,7 @@ class HighWayModel:
"conf_thres": 0.25,
"iou_thres": 0.25,
"classes": 9,
"rainbows": [[0, 0, 255], [0, 255, 0], [255, 0, 0], [255, 0, 0], [255, 255, 0], [255, 0, 0],
[255, 0, 127], [255, 0, 0], [0, 255, 127], [0, 127, 255], [127, 0, 255],
[255, 127, 255],
[255, 255, 127], [127, 255, 255], [0, 255, 255], [255, 127, 255], [127, 255, 255],
[0, 127, 0], [0, 0, 127], [0, 255, 255]]
"rainbows": COLOR
}
}
if self.trtFlag_det and self.trtFlag_seg:
@@ -508,10 +502,7 @@ class ForestModel:
"conf_thres": 0.25,
"iou_thres": 0.45,
"classes": 5,
"rainbows": [[0, 0, 255], [0, 255, 0], [255, 0, 0], [255, 0, 255], [255, 255, 0], [255, 129, 0],
[255, 0, 127], [127, 255, 0], [0, 255, 127], [0, 127, 255], [127, 0, 255],
[255, 127, 255], [255, 255, 127], [127, 255, 255], [0, 255, 255], [255, 127, 255],
[127, 255, 255], [0, 127, 0], [0, 0, 127], [0, 255, 255]]
"rainbows": COLOR
},
'segweights': None
}
@@ -613,10 +604,7 @@ class VehicleModel:
"conf_thres": 0.25,
"iou_thres": 0.45,
"classes": 5,
"rainbows": [[0, 0, 255], [0, 255, 0], [255, 0, 0], [255, 0, 255], [255, 255, 0], [255, 129, 0],
[255, 0, 127], [127, 255, 0], [0, 255, 127], [0, 127, 255], [127, 0, 255],
[255, 127, 255], [255, 255, 127], [127, 255, 255], [0, 255, 255], [255, 127, 255],
[127, 255, 255], [0, 127, 0], [0, 0, 127], [0, 255, 255]]
"rainbows": COLOR
},
'segweights': None
}
@@ -718,10 +706,7 @@ class PedestrianModel:
"conf_thres": 0.25,
"iou_thres": 0.45,
"classes": 5,
"rainbows": [[0, 0, 255], [0, 255, 0], [255, 0, 0], [255, 0, 255], [255, 255, 0], [255, 129, 0],
[255, 0, 127], [127, 255, 0], [0, 255, 127], [0, 127, 255], [127, 0, 255],
[255, 127, 255], [255, 255, 127], [127, 255, 255], [0, 255, 255], [255, 127, 255],
[127, 255, 255], [0, 127, 0], [0, 0, 127], [0, 255, 255]]
"rainbows": COLOR
},
'segweights': None
}
@@ -824,10 +809,7 @@ class SmogfireModel:
"conf_thres": 0.25,
"iou_thres": 0.45,
"classes": 5,
"rainbows": [[0, 0, 255], [0, 255, 0], [255, 0, 0], [255, 0, 255], [255, 255, 0], [255, 129, 0],
[255, 0, 127], [127, 255, 0], [0, 255, 127], [0, 127, 255], [127, 0, 255],
[255, 127, 255], [255, 255, 127], [127, 255, 255], [0, 255, 255], [255, 127, 255],
[127, 255, 255], [0, 127, 0], [0, 0, 127], [0, 255, 255]]
"rainbows": COLOR
},
'segweights': None
}
@@ -929,10 +911,7 @@ class AnglerSwimmerModel:
"conf_thres": 0.25,
"iou_thres": 0.45,
"classes": 5,
"rainbows": [[0, 0, 255], [0, 255, 0], [255, 0, 0], [255, 0, 255], [255, 255, 0], [255, 129, 0],
[255, 0, 127], [127, 255, 0], [0, 255, 127], [0, 127, 255], [127, 0, 255],
[255, 127, 255], [255, 255, 127], [127, 255, 255], [0, 255, 255], [255, 127, 255],
[127, 255, 255], [0, 127, 0], [0, 0, 127], [0, 255, 255]]
"rainbows": COLOR
},
'segweights': None
}
@@ -1035,10 +1014,7 @@ class CountryRoadModel:
"conf_thres": 0.25,
"iou_thres": 0.45,
"classes": 5,
"rainbows": [[0, 0, 255], [0, 255, 0], [255, 0, 0], [255, 0, 255], [255, 255, 0], [255, 129, 0],
[255, 0, 127], [127, 255, 0], [0, 255, 127], [0, 127, 255], [127, 0, 255],
[255, 127, 255], [255, 255, 127], [127, 255, 255], [0, 255, 255], [255, 127, 255],
[127, 255, 255], [0, 127, 0], [0, 0, 127], [0, 255, 255]]
"rainbows": COLOR
},
'segweights': None
}
@@ -1142,10 +1118,7 @@ class ChannelEmergencyModel:
"conf_thres": 0.25,
"iou_thres": 0.45,
"classes": 5,
"rainbows": [[0, 0, 255], [0, 255, 0], [255, 0, 0], [255, 0, 255], [255, 255, 0], [255, 129, 0],
[255, 0, 127], [127, 255, 0], [0, 255, 127], [0, 127, 255], [127, 0, 255],
[255, 127, 255], [255, 255, 127], [127, 255, 255], [0, 255, 255], [255, 127, 255],
[127, 255, 255], [0, 127, 0], [0, 0, 127], [0, 255, 255]]
"rainbows": COLOR
},
'segweights': None
}
@@ -1249,19 +1222,13 @@ class ShipModel:
'heads': {'hm': None, 'wh': 10, 'reg': 2, 'cls_theta': 1},
'decoder': None,
'test_flag': True,
"rainbows": [[0, 0, 255], [0, 0, 255], [255, 0, 0], [0, 0, 255], [255, 255, 0], [0, 0, 255],
[255, 0, 127], [127, 255, 0], [0, 255, 127], [0, 127, 255], [127, 0, 255],
[255, 127, 255], [255, 255, 127], [127, 255, 255], [0, 255, 255], [255, 127, 255],
[127, 255, 255], [0, 127, 0], [0, 0, 127], [0, 255, 255]],
"rainbows": COLOR,
'postFile': {
"name": "post_process",
"conf_thres": 0.25,
"iou_thres": 0.45,
"classes": 5,
"rainbows": [[0, 0, 255], [0, 0, 255], [255, 0, 0], [0, 0, 255], [255, 255, 0], [0, 0, 255],
[255, 0, 127], [127, 255, 0], [0, 255, 127], [0, 127, 255], [127, 0, 255],
[255, 127, 255], [255, 255, 127], [127, 255, 255], [0, 255, 255], [255, 127, 255],
[127, 255, 255], [0, 127, 0], [0, 0, 127], [0, 255, 255]]
"rainbows": COLOR
},
'drawBox': False,
'label_array': None,
@@ -1433,10 +1400,7 @@ class BaiduAiImageModel:
self.__logger = logger
self.__aipBodyAnalysisClient = AipBodyAnalysisClient(content)
self.__aipImageClassifyClient = AipImageClassifyClient(content)
self.rainbows= [[0, 0, 255], [0, 0, 255], [255, 0, 0], [0, 0, 255], [255, 255, 0], [0, 0, 255],
[255, 0, 127], [127, 255, 0], [0, 255, 127], [0, 127, 255], [127, 0, 255],
[255, 127, 255], [255, 255, 127], [127, 255, 255], [0, 255, 255], [255, 127, 255],
[127, 255, 255], [0, 127, 0], [0, 0, 127], [0, 255, 255]]
self.rainbows = COLOR
self.fontPath = "../AIlib2/conf/platech.ttf"
except Exception as ee:
logger.exception("模型加载异常:{}, requestId:{}", ee, requestId)

+ 6
- 4
util/OcrBaiduSdk.py View File

@@ -4,6 +4,7 @@ import cv2
from aip import AipOcr
from loguru import logger

from common import YmlConstant
from enums.BaiduSdkEnum import BAIDUERRORDATA
from enums.ExceptionEnum import ExceptionType
from exception.CustomerException import ServiceException
@@ -11,15 +12,16 @@ from exception.CustomerException import ServiceException

class OcrBaiduSdk:

def __init__(self, content):
self.content = content
def __init__(self, context):
self.__context = context
self.client = None
self.init_client()

def init_client(self):
if self.client is None:
self.client = AipOcr(str(self.content["baidu"]["orc"]["APP_ID"]), self.content["baidu"]["orc"]["API_KEY"],
self.content["baidu"]["orc"]["SECRET_KEY"])
self.client = AipOcr(str(YmlConstant.get_baidu_ocr_APP_ID(self.__context)),
YmlConstant.get_baidu_ocr_API_KEY(self.__context),
YmlConstant.get_baidu_ocr_SECRET_KEY(self.__context))

'''
{

Loading…
Cancel
Save