Ver código fonte

提交线上代码

tags/V2.4.0
chenyukun 2 anos atrás
pai
commit
4fc5bc6341
81 arquivos alterados com 346 adições e 144 exclusões
  1. +16
    -2
      .idea/deployment.xml
  2. +10
    -0
      .idea/runConfigurations.xml
  3. +59
    -14
      .idea/workspace.xml
  4. BIN
      __pycache__/__init__.cpython-310.pyc
  5. BIN
      common/__pycache__/Constant.cpython-310.pyc
  6. BIN
      common/__pycache__/Constant.cpython-38.pyc
  7. BIN
      common/__pycache__/__init__.cpython-310.pyc
  8. BIN
      common/__pycache__/__init__.cpython-38.pyc
  9. +7
    -7
      concurrency/IntelligentRecognitionProcess.py
  10. +1
    -0
      concurrency/MessagePollingThread.py
  11. BIN
      concurrency/__pycache__/CommonProcess.cpython-38.pyc
  12. BIN
      concurrency/__pycache__/CommonThread.cpython-38.pyc
  13. BIN
      concurrency/__pycache__/FileUpdateThread.cpython-38.pyc
  14. BIN
      concurrency/__pycache__/HeartbeatThread.cpython-310.pyc
  15. BIN
      concurrency/__pycache__/HeartbeatThread.cpython-38.pyc
  16. BIN
      concurrency/__pycache__/IntelligentRecognitionProcess.cpython-310.pyc
  17. BIN
      concurrency/__pycache__/IntelligentRecognitionProcess.cpython-38.pyc
  18. BIN
      concurrency/__pycache__/MessagePollingThread.cpython-310.pyc
  19. BIN
      concurrency/__pycache__/MessagePollingThread.cpython-38.pyc
  20. BIN
      concurrency/__pycache__/__init__.cpython-310.pyc
  21. BIN
      concurrency/__pycache__/__init__.cpython-38.pyc
  22. +22
    -2
      dsp_application.yml
  23. +0
    -1
      dsp_master.py
  24. BIN
      entity/__pycache__/FeedBack.cpython-38.pyc
  25. BIN
      entity/__pycache__/__init__.cpython-38.pyc
  26. BIN
      enums/__pycache__/AnalysisStatusEnum.cpython-310.pyc
  27. BIN
      enums/__pycache__/AnalysisStatusEnum.cpython-38.pyc
  28. BIN
      enums/__pycache__/AnalysisTypeEnum.cpython-310.pyc
  29. BIN
      enums/__pycache__/AnalysisTypeEnum.cpython-38.pyc
  30. BIN
      enums/__pycache__/ExceptionEnum.cpython-310.pyc
  31. BIN
      enums/__pycache__/ExceptionEnum.cpython-38.pyc
  32. BIN
      enums/__pycache__/ModelTypeEnum.cpython-310.pyc
  33. BIN
      enums/__pycache__/ModelTypeEnum.cpython-38.pyc
  34. BIN
      enums/__pycache__/__init__.cpython-310.pyc
  35. BIN
      enums/__pycache__/__init__.cpython-38.pyc
  36. BIN
      exception/__pycache__/CustomerException.cpython-310.pyc
  37. BIN
      exception/__pycache__/CustomerException.cpython-38.pyc
  38. BIN
      exception/__pycache__/__init__.cpython-310.pyc
  39. BIN
      exception/__pycache__/__init__.cpython-38.pyc
  40. +5
    -4
      service/Dispatcher.py
  41. BIN
      service/__pycache__/Dispatcher.cpython-310.pyc
  42. BIN
      service/__pycache__/Dispatcher.cpython-38.pyc
  43. BIN
      service/__pycache__/__init__.cpython-310.pyc
  44. BIN
      service/__pycache__/__init__.cpython-38.pyc
  45. BIN
      test/AI.jpg
  46. BIN
      test/a.jpg
  47. BIN
      test/b.jpg
  48. BIN
      test/d.jpg
  49. +12
    -11
      test/ffmpeg11/ffmpeg11.py
  50. +78
    -0
      test/ffmpeg11/ffmpeg33.py
  51. +0
    -0
      test/水印/ORB算法.py
  52. +0
    -0
      test/水印/__init__.py
  53. +2
    -2
      test/水印/互信息.py
  54. +0
    -0
      test/水印/余弦相似度计算.py
  55. +0
    -0
      test/水印/视频添加图片水印1.py
  56. +0
    -0
      test/水印/视频添加文字水印.py
  57. +0
    -0
      test/水印/视频添加文字水印1.py
  58. +0
    -0
      test/水印/视频添加文字水印2.py
  59. +1
    -1
      test/水印/视频添加文字水印3.py
  60. +97
    -86
      util/Cv2Utils.py
  61. +36
    -14
      util/ModelUtils.py
  62. BIN
      util/__pycache__/AliyunSdk.cpython-310.pyc
  63. BIN
      util/__pycache__/AliyunSdk.cpython-38.pyc
  64. BIN
      util/__pycache__/Cv2Utils.cpython-310.pyc
  65. BIN
      util/__pycache__/Cv2Utils.cpython-38.pyc
  66. BIN
      util/__pycache__/FileUtils.cpython-310.pyc
  67. BIN
      util/__pycache__/FileUtils.cpython-38.pyc
  68. BIN
      util/__pycache__/GPUtils.cpython-38.pyc
  69. BIN
      util/__pycache__/ImageUtils.cpython-38.pyc
  70. BIN
      util/__pycache__/KafkaUtils.cpython-310.pyc
  71. BIN
      util/__pycache__/KafkaUtils.cpython-38.pyc
  72. BIN
      util/__pycache__/LogUtils.cpython-310.pyc
  73. BIN
      util/__pycache__/LogUtils.cpython-38.pyc
  74. BIN
      util/__pycache__/ModelUtils.cpython-310.pyc
  75. BIN
      util/__pycache__/ModelUtils.cpython-38.pyc
  76. BIN
      util/__pycache__/TimeUtils.cpython-310.pyc
  77. BIN
      util/__pycache__/TimeUtils.cpython-38.pyc
  78. BIN
      util/__pycache__/YmlUtils.cpython-310.pyc
  79. BIN
      util/__pycache__/YmlUtils.cpython-38.pyc
  80. BIN
      util/__pycache__/__init__.cpython-310.pyc
  81. BIN
      util/__pycache__/__init__.cpython-38.pyc

+ 16
- 2
.idea/deployment.xml Ver arquivo

<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<project version="4"> <project version="4">
<component name="PublishConfigData" autoUpload="Always" serverName="66" remoteFilesAllowedToDisappearOnAutoupload="false">
<component name="PublishConfigData" autoUpload="Always" remoteFilesAllowedToDisappearOnAutoupload="false">
<serverData> <serverData>
<paths name="66"> <paths name="66">
<serverdata> <serverdata>
<mappings> <mappings>
<mapping deploy="/home/DATA/chenyukun/algSch" local="$PROJECT_DIR$" web="/" />
<mapping deploy="/home/DATA/prod/algSch" local="$PROJECT_DIR$" web="/" />
<mapping local="" /> <mapping local="" />
</mappings> </mappings>
</serverdata> </serverdata>
</mappings> </mappings>
</serverdata> </serverdata>
</paths> </paths>
<paths name="thsw2@192.168.10.66:22">
<serverdata>
<mappings>
<mapping local="$PROJECT_DIR$" web="/" />
</mappings>
</serverdata>
</paths>
<paths name="thsw2@212.129.223.66:6500">
<serverdata>
<mappings>
<mapping local="$PROJECT_DIR$" web="/" />
</mappings>
</serverdata>
</paths>
</serverData> </serverData>
<option name="myAutoUpload" value="ALWAYS" /> <option name="myAutoUpload" value="ALWAYS" />
</component> </component>

+ 10
- 0
.idea/runConfigurations.xml Ver arquivo

<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="RunConfigurationProducerService">
<option name="ignoredProducers">
<set>
<option value="com.android.tools.idea.compose.preview.runconfiguration.ComposePreviewRunConfigurationProducer" />
</set>
</option>
</component>
</project>

+ 59
- 14
.idea/workspace.xml Ver arquivo

<option name="autoReloadType" value="SELECTIVE" /> <option name="autoReloadType" value="SELECTIVE" />
</component> </component>
<component name="ChangeListManager"> <component name="ChangeListManager">
<list default="true" id="4f7dccd9-8f92-4a6e-90cc-33890d102263" name="Changes" comment="">
<list default="true" id="4f7dccd9-8f92-4a6e-90cc-33890d102263" name="Changes" comment="Changes">
<change afterPath="$PROJECT_DIR$/.idea/runConfigurations.xml" afterDir="false" />
<change afterPath="$PROJECT_DIR$/test/ffmpeg11/ffmpeg33.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/deployment.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/deployment.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.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/IntelligentRecognitionProcess.py" beforeDir="false" afterPath="$PROJECT_DIR$/concurrency/IntelligentRecognitionProcess.py" afterDir="false" /> <change beforePath="$PROJECT_DIR$/concurrency/IntelligentRecognitionProcess.py" beforeDir="false" afterPath="$PROJECT_DIR$/concurrency/IntelligentRecognitionProcess.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/config/ModelConfig.py" beforeDir="false" afterPath="$PROJECT_DIR$/config/ModelConfig.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/enums/ModelTypeEnum.py" beforeDir="false" afterPath="$PROJECT_DIR$/enums/ModelTypeEnum.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/concurrency/MessagePollingThread.py" beforeDir="false" afterPath="$PROJECT_DIR$/concurrency/MessagePollingThread.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/dsp_application.yml" beforeDir="false" afterPath="$PROJECT_DIR$/dsp_application.yml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/dsp_master.py" beforeDir="false" afterPath="$PROJECT_DIR$/dsp_master.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/service/Dispatcher.py" beforeDir="false" afterPath="$PROJECT_DIR$/service/Dispatcher.py" afterDir="false" /> <change beforePath="$PROJECT_DIR$/service/Dispatcher.py" beforeDir="false" afterPath="$PROJECT_DIR$/service/Dispatcher.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/test/AI.jpg" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/test/ORB算法.py" beforeDir="false" afterPath="$PROJECT_DIR$/test/水印/ORB算法.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/test/a.jpg" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/test/b.jpg" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/test/d.jpg" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/test/互信息.py" beforeDir="false" afterPath="$PROJECT_DIR$/test/水印/互信息.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/test/余弦相似度计算.py" beforeDir="false" afterPath="$PROJECT_DIR$/test/水印/余弦相似度计算.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/test/视频添加图片水印1.py" beforeDir="false" afterPath="$PROJECT_DIR$/test/水印/视频添加图片水印1.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/test/视频添加文字水印.py" beforeDir="false" afterPath="$PROJECT_DIR$/test/水印/视频添加文字水印.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/test/视频添加文字水印1.py" beforeDir="false" afterPath="$PROJECT_DIR$/test/水印/视频添加文字水印1.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/test/视频添加文字水印2.py" beforeDir="false" afterPath="$PROJECT_DIR$/test/水印/视频添加文字水印2.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/test/视频添加文字水印3.py" beforeDir="false" afterPath="$PROJECT_DIR$/test/水印/视频添加文字水印3.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/util/Cv2Utils.py" beforeDir="false" afterPath="$PROJECT_DIR$/util/Cv2Utils.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/ModelUtils.py" beforeDir="false" afterPath="$PROJECT_DIR$/util/ModelUtils.py" afterDir="false" />
</list> </list>
<option name="SHOW_DIALOG" value="false" /> <option name="SHOW_DIALOG" value="false" />
<property name="WebServerToolWindowPanel.toolwindow.show.date" value="false" /> <property name="WebServerToolWindowPanel.toolwindow.show.date" value="false" />
<property name="WebServerToolWindowPanel.toolwindow.show.permissions" value="false" /> <property name="WebServerToolWindowPanel.toolwindow.show.permissions" value="false" />
<property name="WebServerToolWindowPanel.toolwindow.show.size" value="false" /> <property name="WebServerToolWindowPanel.toolwindow.show.size" value="false" />
<property name="last_opened_file_path" value="$PROJECT_DIR$/../../code/river/river_demo" />
<property name="last_opened_file_path" value="$PROJECT_DIR$" />
<property name="node.js.detected.package.eslint" value="true" /> <property name="node.js.detected.package.eslint" value="true" />
<property name="node.js.detected.package.tslint" value="true" /> <property name="node.js.detected.package.tslint" value="true" />
<property name="node.js.selected.package.eslint" value="(autodetect)" /> <property name="node.js.selected.package.eslint" value="(autodetect)" />
</component> </component>
<component name="RecentsManager"> <component name="RecentsManager">
<key name="CopyFile.RECENT_KEYS"> <key name="CopyFile.RECENT_KEYS">
<recent name="D:\work\alg\tuoheng_alg\test\ffmpeg11" />
<recent name="D:\work\alg_new\tuoheng_alg\util" /> <recent name="D:\work\alg_new\tuoheng_alg\util" />
<recent name="D:\work\alg\tuoheng_alg\data" /> <recent name="D:\work\alg\tuoheng_alg\data" />
<recent name="D:\work\alg\tuoheng_alg\test" /> <recent name="D:\work\alg\tuoheng_alg\test" />
<recent name="D:\work\alg\tuoheng_alg\font" /> <recent name="D:\work\alg\tuoheng_alg\font" />
<recent name="D:\work\code_new\tuoheng_alg\enums" />
</key> </key>
<key name="MoveFile.RECENT_KEYS"> <key name="MoveFile.RECENT_KEYS">
<recent name="D:\work\alg\tuoheng_alg\test\水印" />
<recent name="D:\work\alg\tuoheng_alg\image" /> <recent name="D:\work\alg\tuoheng_alg\image" />
</key> </key>
</component> </component>
<component name="RunManager" selected="Python.ImageUtils">
<component name="RunManager" selected="Python.ffmpeg33">
<configuration name="ImageUtils" type="PythonConfigurationType" factoryName="Python" temporary="true" nameIsGenerated="true"> <configuration name="ImageUtils" type="PythonConfigurationType" factoryName="Python" temporary="true" nameIsGenerated="true">
<module name="tuoheng_alg" /> <module name="tuoheng_alg" />
<option name="INTERPRETER_OPTIONS" value="" /> <option name="INTERPRETER_OPTIONS" value="" />
<option name="INPUT_FILE" value="" /> <option name="INPUT_FILE" value="" />
<method v="2" /> <method v="2" />
</configuration> </configuration>
<configuration name="asnyc" type="PythonConfigurationType" factoryName="Python" temporary="true" nameIsGenerated="true">
<configuration name="ffmpeg33" type="PythonConfigurationType" factoryName="Python" temporary="true" nameIsGenerated="true">
<module name="tuoheng_alg" /> <module name="tuoheng_alg" />
<option name="INTERPRETER_OPTIONS" value="" /> <option name="INTERPRETER_OPTIONS" value="" />
<option name="PARENT_ENVS" value="true" /> <option name="PARENT_ENVS" value="true" />
<envs> <envs>
<env name="PYTHONUNBUFFERED" value="1" /> <env name="PYTHONUNBUFFERED" value="1" />
</envs> </envs>
<option name="SDK_HOME" value="sftp://root@212.129.223.66:20653/opt/conda/bin/python3.8" />
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$/test" />
<option name="SDK_HOME" value="$PROJECT_DIR$/../../../software/anaconda/envs/test/python.exe" />
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$/test/ffmpeg11" />
<option name="IS_MODULE_SDK" value="false" /> <option name="IS_MODULE_SDK" value="false" />
<option name="ADD_CONTENT_ROOTS" value="true" /> <option name="ADD_CONTENT_ROOTS" value="true" />
<option name="ADD_SOURCE_ROOTS" value="true" /> <option name="ADD_SOURCE_ROOTS" value="true" />
<EXTENSION ID="PythonCoverageRunConfigurationExtension" runner="coverage.py" /> <EXTENSION ID="PythonCoverageRunConfigurationExtension" runner="coverage.py" />
<option name="SCRIPT_NAME" value="/home/DATA/chenyukun/algSch/test/asnyc.py" />
<option name="SCRIPT_NAME" value="$PROJECT_DIR$/test/ffmpeg11/ffmpeg33.py" />
<option name="PARAMETERS" value="" /> <option name="PARAMETERS" value="" />
<option name="SHOW_COMMAND_LINE" value="false" /> <option name="SHOW_COMMAND_LINE" value="false" />
<option name="EMULATE_TERMINAL" value="false" /> <option name="EMULATE_TERMINAL" value="false" />
</configuration> </configuration>
<list> <list>
<item itemvalue="Python.mysqltest" /> <item itemvalue="Python.mysqltest" />
<item itemvalue="Python.asnyc" />
<item itemvalue="Python.KafkaUtils" /> <item itemvalue="Python.KafkaUtils" />
<item itemvalue="Python.KafkaUtils (1)" /> <item itemvalue="Python.KafkaUtils (1)" />
<item itemvalue="Python.producer_start" /> <item itemvalue="Python.producer_start" />
<item itemvalue="Python.ImageUtils" /> <item itemvalue="Python.ImageUtils" />
<item itemvalue="Python.ffmpeg33" />
</list> </list>
<recent_temporary> <recent_temporary>
<list> <list>
<item itemvalue="Python.ffmpeg33" />
<item itemvalue="Python.ImageUtils" /> <item itemvalue="Python.ImageUtils" />
<item itemvalue="Python.producer_start" /> <item itemvalue="Python.producer_start" />
<item itemvalue="Python.KafkaUtils (1)" /> <item itemvalue="Python.KafkaUtils (1)" />
<item itemvalue="Python.KafkaUtils" /> <item itemvalue="Python.KafkaUtils" />
<item itemvalue="Python.asnyc" />
</list> </list>
</recent_temporary> </recent_temporary>
</component> </component>
<workItem from="1663472604061" duration="19071000" /> <workItem from="1663472604061" duration="19071000" />
<workItem from="1663515200540" duration="648000" /> <workItem from="1663515200540" duration="648000" />
<workItem from="1663545195142" duration="10121000" /> <workItem from="1663545195142" duration="10121000" />
<workItem from="1666136820911" duration="26264000" />
<workItem from="1666223126104" duration="11494000" />
<workItem from="1666269871579" duration="3963000" />
<workItem from="1666351797324" duration="835000" />
<workItem from="1666436589395" duration="2588000" />
<workItem from="1666568450522" duration="695000" />
<workItem from="1666658084006" duration="458000" />
</task> </task>
<servers /> <servers />
</component> </component>
</option> </option>
<option name="oldMeFiltersMigrated" value="true" /> <option name="oldMeFiltersMigrated" value="true" />
</component> </component>
<component name="XDebuggerManager">
<breakpoint-manager>
<breakpoints>
<line-breakpoint enabled="true" suspend="THREAD" type="python-line">
<url>file://$PROJECT_DIR$/test/ffmpeg11/ffmpeg33.py</url>
<line>24</line>
<option name="timeStamp" value="1" />
</line-breakpoint>
<line-breakpoint enabled="true" suspend="THREAD" type="python-line">
<url>file://$PROJECT_DIR$/test/ffmpeg11/ffmpeg33.py</url>
<line>22</line>
<option name="timeStamp" value="2" />
</line-breakpoint>
</breakpoints>
</breakpoint-manager>
</component>
<component name="XSLT-Support.FileAssociations.UIState"> <component name="XSLT-Support.FileAssociations.UIState">
<expand /> <expand />
<select /> <select />
</component> </component>
<component name="com.intellij.coverage.CoverageDataManagerImpl"> <component name="com.intellij.coverage.CoverageDataManagerImpl">
<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$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$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$mysqltest.coverage" NAME="mysqltest Coverage Results" MODIFIED="1660868712851" 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$mysqltest.coverage" NAME="mysqltest Coverage Results" MODIFIED="1660868712851" 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$ffmpeg33.coverage" NAME="ffmpeg33 覆盖结果" MODIFIED="1666185710677" 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$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$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$.coverage" NAME="视频添加图片水印 Coverage Results" MODIFIED="1661873949526" 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$.coverage" NAME="视频添加图片水印 Coverage Results" MODIFIED="1661873949526" 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$1.coverage" NAME="视频添加文字水印1 Coverage Results" MODIFIED="1663381948693" 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$1.coverage" NAME="视频添加文字水印1 Coverage Results" MODIFIED="1663381948693" 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__1_.coverage" NAME="asnyc (1) Coverage Results" MODIFIED="1663458917599" 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__1_.coverage" NAME="asnyc (1) Coverage Results" MODIFIED="1663458917599" 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$producer_start.coverage" NAME="producer_start Coverage Results" MODIFIED="1663466832843" 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$dsp_master.coverage" NAME="dsp_master Coverage Results" MODIFIED="1663403978477" 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$producer_start.coverage" NAME="producer_start 覆盖结果" MODIFIED="1665896605019" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="true" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="/home/DATA/chenyukun/algSch/test" />
<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$dsp_master.coverage" NAME="dsp_master 覆盖结果" MODIFIED="1665892172353" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="true" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="/home/DATA/chenyukun/algSch" />
<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$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$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$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$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$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.coverage" NAME="cv2test1 覆盖结果" MODIFIED="1665738045603" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="true" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="/home/DATA/chenyukun/algSch/test/" />
<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$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$2.coverage" NAME="视频添加图片水印2 Coverage Results" MODIFIED="1661875306428" 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$2.coverage" NAME="视频添加图片水印2 Coverage Results" MODIFIED="1661875306428" 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$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" />

BIN
__pycache__/__init__.cpython-310.pyc Ver arquivo


BIN
common/__pycache__/Constant.cpython-310.pyc Ver arquivo


BIN
common/__pycache__/Constant.cpython-38.pyc Ver arquivo


BIN
common/__pycache__/__init__.cpython-310.pyc Ver arquivo


BIN
common/__pycache__/__init__.cpython-38.pyc Ver arquivo


+ 7
- 7
concurrency/IntelligentRecognitionProcess.py Ver arquivo

import time import time
import copy import copy


import numpy as np

from common import Constant from common import Constant
from multiprocessing import Process, Queue from multiprocessing import Process, Queue
from loguru import logger from loguru import logger
from concurrency.CommonThread import Common from concurrency.CommonThread import Common
from concurrency.CommonProcess import CommonProcess from concurrency.CommonProcess import CommonProcess
from exception.CustomerException import ServiceException from exception.CustomerException import ServiceException
from util.ImageUtils import PictureWaterMark




class IntelligentRecognitionProcess(Process): class IntelligentRecognitionProcess(Process):
self.msg = cfg.get("msg") self.msg = cfg.get("msg")
self.imageQueue = cfg.get("imageQueue") self.imageQueue = cfg.get("imageQueue")
self.gpu_ids = cfg.get("gpu_ids") self.gpu_ids = cfg.get("gpu_ids")
self.pic = cfg.get("pic")
self.pic = PictureWaterMark()
self.type = cfg.get("type") self.type = cfg.get("type")
# 定义原视频、AI视频保存名称 # 定义原视频、AI视频保存名称
random_time = TimeUtils.now_date_to_str(TimeUtils.YMDHMSF) random_time = TimeUtils.now_date_to_str(TimeUtils.YMDHMSF)
high_score_image = {} high_score_image = {}
step = int(self.content["service"]["frame_step"]) step = int(self.content["service"]["frame_step"])
concurrent_frame = 1 concurrent_frame = 1
service_timeout = int(self.content["service"]["timeout"])
while True: while True:
end_time = time.time() end_time = time.time()
create_task_time = int(end_time - start_time) create_task_time = int(end_time - start_time)
if create_task_time > int(self.content["service"]["timeout"]):
if create_task_time > service_timeout:
logger.error("分析超时, 超时时间:{}, requestId: {}", create_task_time, self.msg.get("request_id")) logger.error("分析超时, 超时时间:{}, requestId: {}", create_task_time, self.msg.get("request_id"))
raise ServiceException(ExceptionType.ANALYSE_TIMEOUT_EXCEPTION.value[0], raise ServiceException(ExceptionType.ANALYSE_TIMEOUT_EXCEPTION.value[0],
ExceptionType.ANALYSE_TIMEOUT_EXCEPTION.value[1]) ExceptionType.ANALYSE_TIMEOUT_EXCEPTION.value[1])
raise ServiceException(ExceptionType.PULLSTREAM_TIMEOUT_EXCEPTION.value[0], raise ServiceException(ExceptionType.PULLSTREAM_TIMEOUT_EXCEPTION.value[0],
ExceptionType.PULLSTREAM_TIMEOUT_EXCEPTION.value[1]) ExceptionType.PULLSTREAM_TIMEOUT_EXCEPTION.value[1])
cv2_init_num += 1 cv2_init_num += 1
time.sleep(0.5)
time.sleep(1)
cv2tool.get_video_info() cv2tool.get_video_info()
cv2tool.build_pull_p() cv2tool.build_pull_p()
continue continue
start_time_2 = time.time() start_time_2 = time.time()
# time00 = time.time() # time00 = time.time()
# 调用AI模型 # 调用AI模型
p_result, timeOut = mod.process(copy.deepcopy(frame), cv2tool.width)
p_result, timeOut = mod.process(copy.deepcopy(frame), int(cv2tool.width/2))
# time11 = time.time() # time11 = time.time()
# if time11 - time00 > 1: # if time11 - time00 > 1:
# logger.info("算法模型调度时间:{}s, requestId:{}", int(time11-time00), self.msg.get("request_id")) # logger.info("算法模型调度时间:{}s, requestId:{}", int(time11-time00), self.msg.get("request_id"))
break break
#time00 = time.time() #time00 = time.time()
# 调用AI模型 # 调用AI模型
p_result, timeOut = mod.process(copy.deepcopy(frame), cv2tool.width)
p_result, timeOut = mod.process(copy.deepcopy(frame), int(cv2tool.width/2))
#logger.info("算法模型调度时间:{}s, requestId:{}", time.time() - time00, self.msg.get("request_id")) #logger.info("算法模型调度时间:{}s, requestId:{}", time.time() - time00, self.msg.get("request_id"))
# 原视频保存本地、AI视频保存本地 # 原视频保存本地、AI视频保存本地
if self.content["video"]["video_add_water"]: if self.content["video"]["video_add_water"]:

+ 1
- 0
concurrency/MessagePollingThread.py Ver arquivo

customerKafkaConsumer.commit_offset(m, topics=self.cfg["topics"]) customerKafkaConsumer.commit_offset(m, topics=self.cfg["topics"])
except Exception as e: except Exception as e:
logger.exception("消息监听异常: {}", e) logger.exception("消息监听异常: {}", e)
customerKafkaConsumer = KafkaUtils.CustomerKafkaConsumer(self.cfg["content"])
time.sleep(1) time.sleep(1)


def poll(self): def poll(self):

BIN
concurrency/__pycache__/CommonProcess.cpython-38.pyc Ver arquivo


BIN
concurrency/__pycache__/CommonThread.cpython-38.pyc Ver arquivo


BIN
concurrency/__pycache__/FileUpdateThread.cpython-38.pyc Ver arquivo


BIN
concurrency/__pycache__/HeartbeatThread.cpython-310.pyc Ver arquivo


BIN
concurrency/__pycache__/HeartbeatThread.cpython-38.pyc Ver arquivo


BIN
concurrency/__pycache__/IntelligentRecognitionProcess.cpython-310.pyc Ver arquivo


BIN
concurrency/__pycache__/IntelligentRecognitionProcess.cpython-38.pyc Ver arquivo


BIN
concurrency/__pycache__/MessagePollingThread.cpython-310.pyc Ver arquivo


BIN
concurrency/__pycache__/MessagePollingThread.cpython-38.pyc Ver arquivo


BIN
concurrency/__pycache__/__init__.cpython-310.pyc Ver arquivo


BIN
concurrency/__pycache__/__init__.cpython-38.pyc Ver arquivo


+ 22
- 2
dsp_application.yml Ver arquivo

dsp: dsp:
active: dev
active: prod12
kafka: kafka:
topic: topic:
dsp-alg-online-tasks-topic: dsp-alg-online-tasks dsp-alg-online-tasks-topic: dsp-alg-online-tasks
auto_offset_reset: latest auto_offset_reset: latest
enable_auto_commit: False enable_auto_commit: False
max_poll_records: 1 max_poll_records: 1
test1:
bootstrap_servers: ['192.168.11.242:9092']
dsp-alg-online-tasks:
partition: [1]
dsp-alg-offline-tasks:
partition: [1]
dsp-alg-task-results:
partition: [1]
producer:
acks: -1
retries: 3
linger_ms: 50
retry_backoff_ms: 1000
max_in_flight_requests_per_connection: 5
consumer:
client_id: dsp_ai_server
group_id: dsp-ai-test
auto_offset_reset: latest
enable_auto_commit: False
max_poll_records: 1
prod12: prod12:
bootstrap_servers: ['101.132.127.1:19092'] bootstrap_servers: ['101.132.127.1:19092']
dsp-alg-online-tasks: dsp-alg-online-tasks:
# # maxusage : 单个连接的最大允许复用次数(缺省值 0 或 False 代表不限制的复用).当达到最大数时,连接会自动重新连接(关闭和重新打开) # # maxusage : 单个连接的最大允许复用次数(缺省值 0 或 False 代表不限制的复用).当达到最大数时,连接会自动重新连接(关闭和重新打开)
# db_max_usage: 0 # db_max_usage: 0
# # setsession : 一个可选的SQL命令列表用于准备每个会话,如["set datestyle to german", ...] # # setsession : 一个可选的SQL命令列表用于准备每个会话,如["set datestyle to german", ...]
# db_set_session: None
# db_set_session: None

+ 0
- 1
dsp_master.py Ver arquivo

print("(♥◠‿◠)ノ゙ DSP【算法调度服务】开始启动 ლ(´ڡ`ლ)゙") print("(♥◠‿◠)ノ゙ DSP【算法调度服务】开始启动 ლ(´ڡ`ლ)゙")
# torch.multiprocessing.set_start_method('spawn') # torch.multiprocessing.set_start_method('spawn')
Dispatcher.DispatcherService().start_service() Dispatcher.DispatcherService().start_service()
print("(♥◠‿◠)ノ゙ DSP【算法调度服务】启动成功 ლ(´ڡ`ლ)゙")

BIN
entity/__pycache__/FeedBack.cpython-38.pyc Ver arquivo


BIN
entity/__pycache__/__init__.cpython-38.pyc Ver arquivo


BIN
enums/__pycache__/AnalysisStatusEnum.cpython-310.pyc Ver arquivo


BIN
enums/__pycache__/AnalysisStatusEnum.cpython-38.pyc Ver arquivo


BIN
enums/__pycache__/AnalysisTypeEnum.cpython-310.pyc Ver arquivo


BIN
enums/__pycache__/AnalysisTypeEnum.cpython-38.pyc Ver arquivo


BIN
enums/__pycache__/ExceptionEnum.cpython-310.pyc Ver arquivo


BIN
enums/__pycache__/ExceptionEnum.cpython-38.pyc Ver arquivo


BIN
enums/__pycache__/ModelTypeEnum.cpython-310.pyc Ver arquivo


BIN
enums/__pycache__/ModelTypeEnum.cpython-38.pyc Ver arquivo


BIN
enums/__pycache__/__init__.cpython-310.pyc Ver arquivo


BIN
enums/__pycache__/__init__.cpython-38.pyc Ver arquivo


BIN
exception/__pycache__/CustomerException.cpython-310.pyc Ver arquivo


BIN
exception/__pycache__/CustomerException.cpython-38.pyc Ver arquivo


BIN
exception/__pycache__/__init__.cpython-310.pyc Ver arquivo


BIN
exception/__pycache__/__init__.cpython-38.pyc Ver arquivo


+ 5
- 4
service/Dispatcher.py Ver arquivo

OfflineIntelligentRecognitionProcess OfflineIntelligentRecognitionProcess
from concurrency.MessagePollingThread import OfflineMessagePollingThread, OnlineMessagePollingThread from concurrency.MessagePollingThread import OfflineMessagePollingThread, OnlineMessagePollingThread
from util import GPUtils from util import GPUtils
from util.ImageUtils import PictureWaterMark


''' '''
分发服务 分发服务
# self.photoProcesses = {} # self.photoProcesses = {}
self.onlineMpt = None self.onlineMpt = None
self.offlineMpt = None self.offlineMpt = None
self.pic = PictureWaterMark()


# 服务调用启动方法 # 服务调用启动方法
def start_service(self): def start_service(self):
# 启动实时,离线kafka消息拉取线程 # 启动实时,离线kafka消息拉取线程
self.Kafka_message_listening() self.Kafka_message_listening()
print("(♥◠‿◠)ノ゙ DSP【算法调度服务】启动成功 ლ(´ڡ`ლ)゙")
# 循环消息处理 # 循环消息处理
while True: while True:
time.sleep(1) time.sleep(1)
# 检查任务进程运行情况,去除活动的任务 # 检查任务进程运行情况,去除活动的任务
self.check_process_task() self.check_process_task()
# 获取当前可用gpu使用数量
gpu_ids = GPUtils.get_gpu_ids(self.content) gpu_ids = GPUtils.get_gpu_ids(self.content)
if gpu_ids is not None and len(gpu_ids) > 0: if gpu_ids is not None and len(gpu_ids) > 0:
################## 消息驱动实时流分析进程执行 ################## ################## 消息驱动实时流分析进程执行 ##################
logger.warning("重复任务,请稍后再试!requestId:{}", msg.get("request_id")) logger.warning("重复任务,请稍后再试!requestId:{}", msg.get("request_id"))
return return
cfg = {"fbQueue": Queue(), "imageQueue": Queue(), "content": content, "msg": msg, "gpu_ids": gpu_ids, cfg = {"fbQueue": Queue(), "imageQueue": Queue(), "content": content, "msg": msg, "gpu_ids": gpu_ids,
"pic": self.pic, "type": AnalysisType.ONLINE.value}
"type": AnalysisType.ONLINE.value}
# 创建在线识别进程并启动 # 创建在线识别进程并启动
oirp = OnlineIntelligentRecognitionProcess(cfg) oirp = OnlineIntelligentRecognitionProcess(cfg)
oirp.start() oirp.start()
logger.warning("重复任务,请稍后再试!requestId:{}", msg.get("request_id")) logger.warning("重复任务,请稍后再试!requestId:{}", msg.get("request_id"))
return return
cfg = {"fbQueue": Queue(), "imageQueue": Queue(), "content": content, "msg": msg, "gpu_ids": gpu_ids, cfg = {"fbQueue": Queue(), "imageQueue": Queue(), "content": content, "msg": msg, "gpu_ids": gpu_ids,
"pic": self.pic, "type": AnalysisType.OFFLINE.value}
"type": AnalysisType.OFFLINE.value}
# 创建在线识别进程并启动 # 创建在线识别进程并启动
ofirp = OfflineIntelligentRecognitionProcess(cfg) ofirp = OfflineIntelligentRecognitionProcess(cfg)
ofirp.start() ofirp.start()

BIN
service/__pycache__/Dispatcher.cpython-310.pyc Ver arquivo


BIN
service/__pycache__/Dispatcher.cpython-38.pyc Ver arquivo


BIN
service/__pycache__/__init__.cpython-310.pyc Ver arquivo


BIN
service/__pycache__/__init__.cpython-38.pyc Ver arquivo


BIN
test/AI.jpg Ver arquivo

Antes Depois
Largura: 1920  |  Altura: 1080  |  Tamanho: 477KB

BIN
test/a.jpg Ver arquivo

Antes Depois
Largura: 640  |  Altura: 640  |  Tamanho: 48KB

BIN
test/b.jpg Ver arquivo

Antes Depois
Largura: 1920  |  Altura: 1080  |  Tamanho: 1.5MB

BIN
test/d.jpg Ver arquivo

Antes Depois
Largura: 640  |  Altura: 640  |  Tamanho: 69KB

+ 12
- 11
test/ffmpeg11/ffmpeg11.py Ver arquivo

'-f', 'rawvideo', '-f', 'rawvideo',
'-pix_fmt', 'bgr24', '-pix_fmt', 'bgr24',
'-vcodec','rawvideo', '-vcodec','rawvideo',
# '-s', "{}x{}".format(int(width), int(height)),
'-s', "{}x{}".format(int(width/2), int(height/2)),
'-an', '-an',
'-'] '-']
p = sp.Popen(command, stdout=sp.PIPE) p = sp.Popen(command, stdout=sp.PIPE)
start1 = time.time() start1 = time.time()
while True: while True:
start = time.time() start = time.time()
in_bytes = p.stdout.read(width * height * 3)
in_bytes = p.stdout.read(int(width * height * 3/4))
if not in_bytes: if not in_bytes:
print(in_bytes) print(in_bytes)
ai_video_file.release() ai_video_file.release()
p.wait() p.wait()
break break
# 转成ndarray # 转成ndarray
in_frame = (np.frombuffer(in_bytes, np.uint8).reshape([height, width, 3]))
in_frame = (np.frombuffer(in_bytes, np.uint8).reshape([int(height/2), int(width/2), 3]))
print("拉流时间:", time.time() - start)
# frame = cv2.resize(in_frame, (1280, 720)) # 改变图片尺寸 # frame = cv2.resize(in_frame, (1280, 720)) # 改变图片尺寸
# frame = cv2.cvtColor(in_frame, cv2.COLOR_RGB2BGR) # 转成BGR # frame = cv2.cvtColor(in_frame, cv2.COLOR_RGB2BGR) # 转成BGR
# i += 1 # i += 1
print(round(time.time()-start, 5))
ai_video_file.write(in_frame)
if time.time() - start1 > 60:
ai_video_file.release()
p.stdout.close()
p.wait()
break
# print(round(time.time()-start, 5))
#
# ai_video_file.write(in_frame)
# if time.time() - start1 > 60:
# ai_video_file.release()
# p.stdout.close()
# p.wait()
# break
# cv2.imshow('frame', frame) # cv2.imshow('frame', frame)
# time.sleep(1111) # time.sleep(1111)
p.kill() p.kill()

+ 78
- 0
test/ffmpeg11/ffmpeg33.py Ver arquivo

import subprocess as sp
import time
import cv2
import ffmpeg
# 推流
import numpy as np

if __name__== "__main__":


# with open(str(cv2.__file__),"r") as f:
# print (f.read())
# aa = {'loglevel': 'error'}
# process = (
# ffmpeg
# .input("http://cmgw-vpc.lechange.com:8888/LCO/8D0B355PAN8B3B3/0/0/20221019T130437/eabfe43d95971e0ae03de28dad4fd4ce.m3u8", **aa)
# .output('pipe:', format='rawvideo', pix_fmt='bgr24', loglevel='error')# , bufsize='1000000k'
# .overwrite_output()
# .global_args('-an')
# .run_async(pipe_stdout=True)
# )
# self.pull_p = sp.Popen(command, stdout=sp.PIPE, stderr=sp.PIPE)
cap = cv2.VideoCapture("http://cmgw-vpc.lechange.com:8888/LCO/8D0B355PAN8B3B3/0/0/20221019T130437/eabfe43d95971e0ae03de28dad4fd4ce.m3u8")
fps = int(cap.get(cv2.CAP_PROP_FPS))
print(fps)
width = int(cap.get(cv2.CAP_PROP_FRAME_WIDTH))
print(width)
height = int(cap.get(cv2.CAP_PROP_FRAME_HEIGHT))
print(height)
fourcc = int(cap.get(cv2.CAP_PROP_FOURCC))
print(fourcc)
# print(cv2.getBuildInformation())
# cap.setExceptionMode(True)
# print(cap.getExceptionMode())
# cap.set(cv2.CAP_PROP_FRAME_WIDTH, 1920)
# cap.set(cv2.CAP_PROP_FRAME_HEIGHT, 1080)
# cap.set(cv2.CAP_PROP_FPS, 25)
command = ['ffmpeg',
'-y', # 不经过确认,输出时直接覆盖同名文件。
'-f', 'rawvideo',
'-vcodec','rawvideo',
'-pix_fmt', 'bgr24',
# '-r', str(13),
'-s', "{}x{}".format(width, height),
# '-s', "{}x{}".format(1280, 720),
'-i', '-', # 指定输入文件
'-c:v', 'libx264', # 指定视频编码器
'-pix_fmt', 'yuv420p',
"-an",
# '-b:v', '3000k',
'-preset', 'ultrafast', # 指定输出的视频质量,会影响文件的生成速度,有以下几个可用的值 ultrafast,
# superfast, veryfast, faster, fast, medium, slow, slower, veryslow。
'-f', 'flv',
"rtmp://live.push.t-aaron.com/live/THSAq"]

# # 管道配置
p = sp.Popen(command, stdin=sp.PIPE)
# while(cap.isOpened()):
while True:
start =time.time()
# in_bytes = process.stdout.read(1920 * 1080 * 3)
# result = (np.frombuffer(in_bytes, np.uint8).reshape([1080, 1920, 3]))
# time.sleep(0.04)
ret, frame = cap.read()
# print(cap.grab())
# print("aaaaaaaaaaaaaa", time.time()-start)
# start =time.time()
# a,b = cap.retrieve()
# print("bbbbbbbbbbbbbb", time.time()-start)
# if not ret:
# print("Opening camera is failed")
# break
# cv2.namedWindow('picture',0)
# cv2.resizeWindow("picture", 1980, 1080)
# cv2.imshow('picture', result)
# cv2.waitKey(1) & 0xFF == ord('q')
p.stdin.write(frame.tostring())


test/ORB算法.py → test/水印/ORB算法.py Ver arquivo


+ 0
- 0
test/水印/__init__.py Ver arquivo


test/互信息.py → test/水印/互信息.py Ver arquivo

from PIL import Image from PIL import Image
from pixelmatch.contrib.PIL import pixelmatch from pixelmatch.contrib.PIL import pixelmatch
img_a = Image.open("image/AI.jpg")
img_b = Image.open("image/AI3.jpg")
img_a = Image.open("../image/AI.jpg")
img_b = Image.open("../image/AI3.jpg")
img_diff = Image.new("RGBA", img_a.size) img_diff = Image.new("RGBA", img_a.size)
# note how there is no need to specify dimensions # note how there is no need to specify dimensions
mismatch = pixelmatch(img_a, img_b, img_diff, includeAA=True) mismatch = pixelmatch(img_a, img_b, img_diff, includeAA=True)

test/余弦相似度计算.py → test/水印/余弦相似度计算.py Ver arquivo


test/视频添加图片水印1.py → test/水印/视频添加图片水印1.py Ver arquivo


test/视频添加文字水印.py → test/水印/视频添加文字水印.py Ver arquivo


test/视频添加文字水印1.py → test/水印/视频添加文字水印1.py Ver arquivo


test/视频添加文字水印2.py → test/水印/视频添加文字水印2.py Ver arquivo


test/视频添加文字水印3.py → test/水印/视频添加文字水印3.py Ver arquivo





if __name__ == '__main__': if __name__ == '__main__':
img = Image.open("a.jpg")
img = Image.open("../a.jpg")
fontcolor = 'yellow' fontcolor = 'yellow'


water = Water() water = Water()

+ 97
- 86
util/Cv2Utils.py Ver arquivo

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




class Cv2Util(): class Cv2Util():


def __init__(self, pullUrl, pushUrl=None, orFilePath=None, aiFilePath=None, requestId=None): def __init__(self, pullUrl, pushUrl=None, orFilePath=None, aiFilePath=None, requestId=None):
self.fps = None self.fps = None
self.width = None self.width = None
self.height = None self.height = None
self.wh = None
self.all_frames = None self.all_frames = None
self.bit_rate = None self.bit_rate = None
self.pull_p = None self.pull_p = None
''' '''
获取视频信息 获取视频信息
''' '''

def get_video_info(self): def get_video_info(self):
try: try:
if self.pullUrl is None: if self.pullUrl is None:
self.width = int(width) self.width = int(width)
if height: if height:
self.height = int(height) self.height = int(height)
if width is not None and height is not None:
self.wh = int(width * height * 3 / 4)
if nb_frames: if nb_frames:
self.all_frames = int(nb_frames) self.all_frames = int(nb_frames)
if fps: if fps:
# if duration: # if duration:
# self.duration = float(video_stream['duration']) # self.duration = float(video_stream['duration'])
if bit_rate: if bit_rate:
self.bit_rate = int(bit_rate)/1000
self.bit_rate = int(bit_rate) / 1000
logger.info("视频信息, width:{}|height:{}|fps:{}|all_frames:{}|bit_rate:{}, requestId:{}", self.width, logger.info("视频信息, width:{}|height:{}|fps:{}|all_frames:{}|bit_rate:{}, requestId:{}", self.width,
self.height, self.fps, self.all_frames, self.bit_rate, self.requestId) self.height, self.fps, self.all_frames, self.bit_rate, self.requestId)
except ServiceException as s: except ServiceException as s:
except Exception as e: except Exception as e:
logger.exception("获取视频信息异常:{}, requestId:{}", e, self.requestId) logger.exception("获取视频信息异常:{}, requestId:{}", e, self.requestId)




''' '''
拉取视频 拉取视频
''' '''

def build_pull_p(self): def build_pull_p(self):
try: try:
if self.width is None or self.height is None:
return
if self.pull_p: if self.pull_p:
logger.info("重试, 关闭拉流管道, requestId:{}", self.requestId) logger.info("重试, 关闭拉流管道, requestId:{}", self.requestId)
self.pull_p.stdout.close() self.pull_p.stdout.close()
# # '-s', "{}x{}".format(int(width), int(height)), # # '-s', "{}x{}".format(int(width), int(height)),
# '-an', # '-an',
# '-'] # '-']
aa = {'loglevel': 'error'}
process = ( process = (
ffmpeg ffmpeg
.input(self.pullUrl)
.output('pipe:', format='rawvideo', pix_fmt='bgr24')
.input(self.pullUrl, **aa)
.output('pipe:', format='rawvideo', pix_fmt='bgr24', loglevel='error',
s="{}x{}".format(int(self.width / 2), int(self.height / 2)))
.overwrite_output() .overwrite_output()
.global_args('-an') .global_args('-an')
.run_async(pipe_stdout=True) .run_async(pipe_stdout=True)
def read(self): def read(self):
result = None result = None
try: try:
if self.pull_p is None:
logger.error("拉流管道为空, requestId:{}", self.requestId)
raise ServiceException(ExceptionType.PULL_PIPELINE_INIT_EXCEPTION.value[0],
ExceptionType.PULL_PIPELINE_INIT_EXCEPTION.value[1])
in_bytes = self.pull_p.stdout.read(self.width * self.height * 3)
# if self.pull_p is None:
# logger.error("拉流管道为空, requestId:{}", self.requestId)
# raise ServiceException(ExceptionType.PULL_PIPELINE_INIT_EXCEPTION.value[0],
# ExceptionType.PULL_PIPELINE_INIT_EXCEPTION.value[1])
in_bytes = self.pull_p.stdout.read(self.wh)
if in_bytes is not None and len(in_bytes) > 0: if in_bytes is not None and len(in_bytes) > 0:
result = (np.frombuffer(in_bytes, np.uint8).reshape([self.height, self.width, 3]))
result = (np.frombuffer(in_bytes, np.uint8).reshape([int(self.height / 2), int(self.width / 2), 3]))
except ServiceException as s: except ServiceException as s:
logger.exception("读流异常: {}, requestId:{}", s, self.requestId) logger.exception("读流异常: {}, requestId:{}", s, self.requestId)
except Exception as e: except Exception as e:
logger.info("关闭AI视频写入流完成, requestId:{}", self.requestId) logger.info("关闭AI视频写入流完成, requestId:{}", self.requestId)


# 构建 cv2 # 构建 cv2
def build_cv2(self):
try:
if self.cap is not None:
logger.info("重试, 关闭cap, requestId:{}", self.requestId)
self.cap.release()
if self.p is not None:
logger.info("重试, 关闭管道, requestId:{}", self.requestId)
self.p.stdin.close()
self.p.terminate()
self.p.wait()
if self.pullUrl is None:
logger.error("拉流地址不能为空, requestId:{}", self.requestId)
raise ServiceException(ExceptionType.PULL_STREAM_URL_EXCEPTION.value[0],
ExceptionType.PULL_STREAM_URL_EXCEPTION.value[1])
if self.pushUrl is None:
logger.error("推流地址不能为空, requestId:{}", self.requestId)
raise ServiceException(ExceptionType.PUSH_STREAM_URL_EXCEPTION.value[0],
ExceptionType.PUSH_STREAM_URL_EXCEPTION.value[1])
self.cap = cv2.VideoCapture(self.pullUrl)
if self.fps is None or self.fps == 0:
self.fps = int(self.cap.get(cv2.CAP_PROP_FPS))
if self.width is None or self.width == 0:
self.width = int(self.cap.get(cv2.CAP_PROP_FRAME_WIDTH))
if self.height is None or self.height == 0:
self.height = int(self.cap.get(cv2.CAP_PROP_FRAME_HEIGHT))
command = ['/usr/bin/ffmpeg',
# '-y', # 不经过确认,输出时直接覆盖同名文件。
'-f', 'rawvideo',
'-vcodec', 'rawvideo',
'-pix_fmt', 'bgr24', # 显示可用的像素格式
# '-s', "{}x{}".format(self.width * 2, self.height),
'-s', "{}x{}".format(int(self.width), int(self.height/2)),
# '-r', str(15),
'-i', '-', # 指定输入文件
'-g', '25',
'-b:v', '3000k',
'-tune', 'zerolatency', # 加速编码速度
'-c:v', 'libx264', # 指定视频编码器
'-sc_threshold', '0',
'-pix_fmt', 'yuv420p',
'-an',
'-preset', 'ultrafast', # 指定输出的视频质量,会影响文件的生成速度,有以下几个可用的值 ultrafast,
# superfast, veryfast, faster, fast, medium, slow, slower, veryslow。
'-f', 'flv',
self.pushUrl]
# 管道配置
logger.info("fps:{}|height:{}|width:{}|requestId:{}", self.fps, self.height, self.width, self.requestId)
self.p = sp.Popen(command, stdin=sp.PIPE)
except ServiceException as s:
logger.exception("构建cv2异常: {}, requestId:{}", s, self.requestId)
raise s
except Exception as e:
logger.exception("初始化cv2异常:{}, requestId:{}", e, self.requestId)

# def build_cv2(self):
# try:
# if self.cap is not None:
# logger.info("重试, 关闭cap, requestId:{}", self.requestId)
# self.cap.release()
# if self.p is not None:
# logger.info("重试, 关闭管道, requestId:{}", self.requestId)
# self.p.stdin.close()
# self.p.terminate()
# self.p.wait()
# if self.pullUrl is None:
# logger.error("拉流地址不能为空, requestId:{}", self.requestId)
# raise ServiceException(ExceptionType.PULL_STREAM_URL_EXCEPTION.value[0],
# ExceptionType.PULL_STREAM_URL_EXCEPTION.value[1])
# if self.pushUrl is None:
# logger.error("推流地址不能为空, requestId:{}", self.requestId)
# raise ServiceException(ExceptionType.PUSH_STREAM_URL_EXCEPTION.value[0],
# ExceptionType.PUSH_STREAM_URL_EXCEPTION.value[1])
# self.cap = cv2.VideoCapture(self.pullUrl)
# if self.fps is None or self.fps == 0:
# self.fps = int(self.cap.get(cv2.CAP_PROP_FPS))
# if self.width is None or self.width == 0:
# self.width = int(self.cap.get(cv2.CAP_PROP_FRAME_WIDTH))
# if self.height is None or self.height == 0:
# self.height = int(self.cap.get(cv2.CAP_PROP_FRAME_HEIGHT))
# command = ['/usr/bin/ffmpeg',
# # '-y', # 不经过确认,输出时直接覆盖同名文件。
# '-f', 'rawvideo',
# '-vcodec', 'rawvideo',
# '-pix_fmt', 'bgr24', # 显示可用的像素格式
# # '-s', "{}x{}".format(self.width * 2, self.height),
# '-s', "{}x{}".format(int(self.width), int(self.height/2)),
# # '-r', str(15),
# '-i', '-', # 指定输入文件
# '-g', '25',
# '-b:v', '3000k',
# '-tune', 'zerolatency', # 加速编码速度
# '-c:v', 'libx264', # 指定视频编码器
# '-sc_threshold', '0',
# '-pix_fmt', 'yuv420p',
# '-an',
# '-preset', 'ultrafast', # 指定输出的视频质量,会影响文件的生成速度,有以下几个可用的值 ultrafast,
# # superfast, veryfast, faster, fast, medium, slow, slower, veryslow。
# '-f', 'flv',
# self.pushUrl]
# # 管道配置
# logger.info("fps:{}|height:{}|width:{}|requestId:{}", self.fps, self.height, self.width, self.requestId)
# self.p = sp.Popen(command, stdin=sp.PIPE)
# except ServiceException as s:
# logger.exception("构建cv2异常: {}, requestId:{}", s, self.requestId)
# raise s
# except Exception as e:
# logger.exception("初始化cv2异常:{}, requestId:{}", e, self.requestId)


# 构建 cv2
# 构建 cv2
def build_p(self): def build_p(self):
try: try:
if self.p: if self.p:
logger.info("重试, 关闭管道, requestId:{}", self.requestId) logger.info("重试, 关闭管道, requestId:{}", self.requestId)
self.p.stdin.close()
if self.p.stdin:
self.p.stdin.close()
self.p.terminate() self.p.terminate()
self.p.wait() self.p.wait()
# self.p.communicate() # self.p.communicate()
raise ServiceException(ExceptionType.PUSH_STREAM_URL_EXCEPTION.value[0], raise ServiceException(ExceptionType.PUSH_STREAM_URL_EXCEPTION.value[0],
ExceptionType.PUSH_STREAM_URL_EXCEPTION.value[1]) ExceptionType.PUSH_STREAM_URL_EXCEPTION.value[1])
command = ['ffmpeg', command = ['ffmpeg',
# '-loglevel', 'debug',
'-y', # 不经过确认,输出时直接覆盖同名文件。 '-y', # 不经过确认,输出时直接覆盖同名文件。
'-f', 'rawvideo', '-f', 'rawvideo',
'-vcodec', 'rawvideo', '-vcodec', 'rawvideo',
'-pix_fmt', 'bgr24', '-pix_fmt', 'bgr24',
# '-s', "{}x{}".format(self.width * 2, self.height), # '-s', "{}x{}".format(self.width * 2, self.height),
'-s', "{}x{}".format(int(self.width), int(self.height/2)),
'-s', "{}x{}".format(int(self.width), int(self.height / 2)),
'-r', str(self.fps), '-r', str(self.fps),
'-i', '-', # 指定输入文件 '-i', '-', # 指定输入文件
'-g', str(self.fps), '-g', str(self.fps),
# '-maxrate', '15000k', # '-maxrate', '15000k',
'-b:v', '6000k',
# '-crf', '18',s
'-bufsize', '6000k',
'-tune', 'zerolatency', # 加速编码速度
# '-profile:v', 'high',
'-b:v', '4000k',
# '-crf', '18',
'-bufsize', '4000k',
'-c:v', 'libx264', # 指定视频编码器 '-c:v', 'libx264', # 指定视频编码器
'-tune', 'zerolatency', # 加速编码速度
'-sc_threshold', '0', '-sc_threshold', '0',
'-pix_fmt', 'yuv420p', '-pix_fmt', 'yuv420p',
"-an", "-an",
# '-flvflags', 'no_duration_filesize', # '-flvflags', 'no_duration_filesize',
'-preset', 'medium', # 指定输出的视频质量,会影响文件的生成速度,有以下几个可用的值 ultrafast,
'-preset', 'veryfast', # 指定输出的视频质量,会影响文件的生成速度,有以下几个可用的值 ultrafast,
# superfast, veryfast, faster, fast, medium, slow, slower, veryslow。 # superfast, veryfast, faster, fast, medium, slow, slower, veryslow。
'-f', 'flv', '-f', 'flv',
self.pushUrl] self.pushUrl]
# ' -f flv ' + self.pushUrl # ' -f flv ' + self.pushUrl


# kwargs = {'format': 'rawvideo', # kwargs = {'format': 'rawvideo',
# 'vcodec': 'rawvideo',
# # 'vcodec': 'rawvideo',
# 'pix_fmt': 'bgr24', # 'pix_fmt': 'bgr24',
# 's': '{}x{}'.format(int(self.width), int(self.height/2))} # 's': '{}x{}'.format(int(self.width), int(self.height/2))}
# out = { # out = {
# 'r': str(self.fps),
# 'g': str(self.fps), # 'g': str(self.fps),
# 'b:v': '8000k', # 恒定码率
# 'maxrate': '15000k',
# 'b:v': '5500k', # 恒定码率
# # 'maxrate': '15000k',
# # 'crf': '18', # # 'crf': '18',
# 'bufsize': '3000k',
# 'bufsize': '5500k',
# 'tune': 'zerolatency', # 加速编码速度 # 'tune': 'zerolatency', # 加速编码速度
# 'c:v': 'libx264', # 指定视频编码器 # 'c:v': 'libx264', # 指定视频编码器
# 'sc_threshold': '0', # 'sc_threshold': '0',
# 'pix_fmt': 'yuv420p', # 'pix_fmt': 'yuv420p',
# # 'flvflags': 'no_duration_filesize', # # 'flvflags': 'no_duration_filesize',
# 'preset': 'ultrafast', # 指定输出的视频质量,会影响文件的生成速度,有以下几个可用的值 ultrafast,
# 'preset': 'medium', # 指定输出的视频质量,会影响文件的生成速度,有以下几个可用的值 ultrafast,
# # superfast, veryfast, faster, fast, medium, slow, slower, veryslow。 # # superfast, veryfast, faster, fast, medium, slow, slower, veryslow。
# 'format': 'flv'} # 'format': 'flv'}
# 管道配置 # 管道配置
# ffmpeg # ffmpeg
# .input('pipe:', **kwargs) # .input('pipe:', **kwargs)
# .output(self.pushUrl, **out) # .output(self.pushUrl, **out)
# .global_args('-re', '-y', '-an')
# .global_args('-y', '-an')
# .overwrite_output() # .overwrite_output()
# .run_async(pipe_stdin=True) # .run_async(pipe_stdin=True)
# ) # )
logger.info("fps:{}|height:{}|width:{}|requestId:{}", self.fps, self.height, self.width, self.requestId) logger.info("fps:{}|height:{}|width:{}|requestId:{}", self.fps, self.height, self.width, self.requestId)
self.p = sp.Popen(command, stdin=sp.PIPE, shell=False) self.p = sp.Popen(command, stdin=sp.PIPE, shell=False)

# self.p = process2 # self.p = process2
except ServiceException as s: except ServiceException as s:
logger.exception("构建p管道异常: {}, requestId:{}", s, self.requestId) logger.exception("构建p管道异常: {}, requestId:{}", s, self.requestId)
current_retry_num = 0 current_retry_num = 0
while True: while True:
try: try:
if self.p_push_retry_num > 500:
if self.p_push_retry_num > 20:
logger.info("推流失败重试次数过多, 请检查相关配置信息, 当前重试次数: {}, requestId: {}", logger.info("推流失败重试次数过多, 请检查相关配置信息, 当前重试次数: {}, requestId: {}",
self.p_push_retry_num, self.requestId) self.p_push_retry_num, self.requestId)
current_retry_num = 4 current_retry_num = 4
break break
self.p_push_retry_num += 1 self.p_push_retry_num += 1
time.sleep(10)
self.build_p() self.build_p()
self.p.stdin.write(frame.tostring()) self.p.stdin.write(frame.tostring())
logger.info("构建p管道重试成功, 当前重试次数: {}, requestId: {}", current_retry_num, logger.info("构建p管道重试成功, 当前重试次数: {}, requestId: {}", current_retry_num,
raise ServiceException(ExceptionType.SERVICE_INNER_EXCEPTION.value[0], raise ServiceException(ExceptionType.SERVICE_INNER_EXCEPTION.value[0],
ExceptionType.SERVICE_INNER_EXCEPTION.value[1]) ExceptionType.SERVICE_INNER_EXCEPTION.value[1])



def build_write(self): def build_write(self):
try: try:
if self.fps is None or self.width is None or self.height is None: if self.fps is None or self.width is None or self.height is None:
ExceptionType.VIDEO_CONFIG_EXCEPTION.value[1]) ExceptionType.VIDEO_CONFIG_EXCEPTION.value[1])
if self.orFilePath is not None and self.or_video_file is None: if self.orFilePath is not None and self.or_video_file is None:
self.or_video_file = cv2.VideoWriter(self.orFilePath, cv2.VideoWriter_fourcc(*'mp4v'), self.fps, self.or_video_file = cv2.VideoWriter(self.orFilePath, cv2.VideoWriter_fourcc(*'mp4v'), self.fps,
(self.width, self.height))
(int(self.width / 2), int(self.height / 2)))
if self.or_video_file is None: if self.or_video_file is None:
raise ServiceException(ExceptionType.OR_WRITE_OBJECT_EXCEPTION.value[0], raise ServiceException(ExceptionType.OR_WRITE_OBJECT_EXCEPTION.value[0],
ExceptionType.OR_WRITE_OBJECT_EXCEPTION.value[1]) ExceptionType.OR_WRITE_OBJECT_EXCEPTION.value[1])
if self.aiFilePath is not None and self.ai_video_file is None: if self.aiFilePath is not None and self.ai_video_file is None:
self.ai_video_file = cv2.VideoWriter(self.aiFilePath, cv2.VideoWriter_fourcc(*'mp4v'), self.fps, self.ai_video_file = cv2.VideoWriter(self.aiFilePath, cv2.VideoWriter_fourcc(*'mp4v'), self.fps,
(int(self.width), int(self.height/2)))
(int(self.width), int(self.height / 2)))
if self.ai_video_file is None: if self.ai_video_file is None:
raise ServiceException(ExceptionType.AI_WRITE_OBJECT_EXCEPTION.value[0], raise ServiceException(ExceptionType.AI_WRITE_OBJECT_EXCEPTION.value[0],
ExceptionType.AI_WRITE_OBJECT_EXCEPTION.value[1]) ExceptionType.AI_WRITE_OBJECT_EXCEPTION.value[1])
raise e raise e


def video_merge(self, frame1, frame2): def video_merge(self, frame1, frame2):
frameLeft = cv2.resize(frame1, (int(self.width/2), int(self.height/2)), interpolation=cv2.INTER_LINEAR)
frameRight = cv2.resize(frame2, (int(self.width/2), int(self.height/2)), interpolation=cv2.INTER_LINEAR)
frameLeft = cv2.resize(frame1, (int(self.width / 2), int(self.height / 2)), interpolation=cv2.INTER_LINEAR)
frameRight = cv2.resize(frame2, (int(self.width / 2), int(self.height / 2)), interpolation=cv2.INTER_LINEAR)
frame_merge = np.hstack((frameLeft, frameRight)) frame_merge = np.hstack((frameLeft, frameRight))
# frame_merge = np.hstack((frame1, frame2)) # frame_merge = np.hstack((frame1, frame2))
return frame_merge return frame_merge

+ 36
- 14
util/ModelUtils.py Ver arquivo

if self.label_arraylist is None: if self.label_arraylist is None:
fontsize = int(width/1920*40) fontsize = int(width/1920*40)
line_thickness = 1 line_thickness = 1
if width > 1280:
line_thickness = int(round(width/1920*3))
waterLineWidth = int(round(width/1920*3) + 1)
numFontSize = float(format(width/1920*1.1, '.1f'))
self.digitFont = {'line_thickness': line_thickness, 'fontSize': numFontSize, 'waterLineColor':(0,255,255), 'waterLineWidth': waterLineWidth}
boxLine_thickness = 1
waterLineWidth = 1
if width >= 960:
line_thickness = int(round(width/1920*3) - 1)
boxLine_thickness = int(round(width/1920*3))
waterLineWidth = int(round(width/1920*3))
numFontSize = float(format(width/1920*1.1, '.1f')) # 文字大小
self.digitFont = {'line_thickness': line_thickness,
'boxLine_thickness': boxLine_thickness,
'fontSize': numFontSize,
'waterLineColor': (0, 255, 255),
'waterLineWidth': waterLineWidth}
self.label_arraylist = get_label_arrays(self.names, self.rainbows, outfontsize=fontsize, self.label_arraylist = get_label_arrays(self.names, self.rainbows, outfontsize=fontsize,
fontpath="../AIlib/conf/platech.ttf") fontpath="../AIlib/conf/platech.ttf")
return AI_process([frame], self.model, self.segmodel, self.names, self.label_arraylist, return AI_process([frame], self.model, self.segmodel, self.names, self.label_arraylist,
if self.label_arraylist is None: if self.label_arraylist is None:
fontsize = int(width/1920*40) fontsize = int(width/1920*40)
line_thickness = 1 line_thickness = 1
if width > 1280:
line_thickness = int(round(width/1920*3))
waterLineWidth = int(round(width/1920*3) + 1)
numFontSize = float(format(width/1920*1.1, '.1f'))
self.digitFont = {'line_thickness': line_thickness, 'fontSize': numFontSize, 'waterLineColor':(0,255,255), 'waterLineWidth': waterLineWidth} ###数字显示的线宽度,大小; 如果都是None,则采用默认大小
boxLine_thickness = 1
waterLineWidth = 1
if width >= 960:
line_thickness = int(round(width/1920*3) - 1)
boxLine_thickness = int(round(width/1920*3))
waterLineWidth = int(round(width/1920*3))
numFontSize = float(format(width/1920*1.1, '.1f')) # 文字大小
self.digitFont = {'line_thickness': line_thickness,
'boxLine_thickness': boxLine_thickness,
'fontSize': numFontSize,
'waterLineColor': (0, 255, 255),
'waterLineWidth': waterLineWidth}
self.label_arraylist = get_label_arrays(self.names, self.rainbows, outfontsize=fontsize, fontpath="../AIlib/conf/platech.ttf") self.label_arraylist = get_label_arrays(self.names, self.rainbows, outfontsize=fontsize, fontpath="../AIlib/conf/platech.ttf")
return AI_process_forest([frame], self.model, self.segmodel, self.names, self.label_arraylist, return AI_process_forest([frame], self.model, self.segmodel, self.names, self.label_arraylist,
self.rainbows, self.half, self.device, self.conf_thres, self.iou_thres, self.rainbows, self.half, self.device, self.conf_thres, self.iou_thres,
if self.label_arraylist is None: if self.label_arraylist is None:
fontsize = int(width/1920*40) fontsize = int(width/1920*40)
line_thickness = 1 line_thickness = 1
if width > 1280:
line_thickness = int(round(width/1920*3))
waterLineWidth = int(round(width/1920*3) + 1)
boxLine_thickness = 1
waterLineWidth = 1
if width >= 960:
line_thickness = int(round(width/1920*3) - 1)
boxLine_thickness = int(round(width/1920*2))
waterLineWidth = int(round(width/1920*3))
numFontSize = float(format(width/1920*1.1, '.1f')) numFontSize = float(format(width/1920*1.1, '.1f'))
self.digitFont = {'line_thickness': line_thickness, 'fontSize': numFontSize, 'waterLineColor':(0,255,255), 'waterLineWidth': waterLineWidth} ###数字显示的线宽度,大小; 如果都是None,则采用默认大小

self.digitFont = {'line_thickness': line_thickness,
'boxLine_thickness': boxLine_thickness,
'fontSize': numFontSize,
'waterLineColor': (0, 255, 255),
'waterLineWidth': waterLineWidth}
self.label_arraylist = get_label_arrays(self.names, self.rainbows, outfontsize=fontsize, fontpath="../AIlib/conf/platech.ttf") self.label_arraylist = get_label_arrays(self.names, self.rainbows, outfontsize=fontsize, fontpath="../AIlib/conf/platech.ttf")
return AI_process_forest([frame], self.model, self.segmodel, self.names, self.label_arraylist, return AI_process_forest([frame], self.model, self.segmodel, self.names, self.label_arraylist,
self.rainbows, self.half, self.device, self.conf_thres, self.iou_thres, self.rainbows, self.half, self.device, self.conf_thres, self.iou_thres,

BIN
util/__pycache__/AliyunSdk.cpython-310.pyc Ver arquivo


BIN
util/__pycache__/AliyunSdk.cpython-38.pyc Ver arquivo


BIN
util/__pycache__/Cv2Utils.cpython-310.pyc Ver arquivo


BIN
util/__pycache__/Cv2Utils.cpython-38.pyc Ver arquivo


BIN
util/__pycache__/FileUtils.cpython-310.pyc Ver arquivo


BIN
util/__pycache__/FileUtils.cpython-38.pyc Ver arquivo


BIN
util/__pycache__/GPUtils.cpython-38.pyc Ver arquivo


BIN
util/__pycache__/ImageUtils.cpython-38.pyc Ver arquivo


BIN
util/__pycache__/KafkaUtils.cpython-310.pyc Ver arquivo


BIN
util/__pycache__/KafkaUtils.cpython-38.pyc Ver arquivo


BIN
util/__pycache__/LogUtils.cpython-310.pyc Ver arquivo


BIN
util/__pycache__/LogUtils.cpython-38.pyc Ver arquivo


BIN
util/__pycache__/ModelUtils.cpython-310.pyc Ver arquivo


BIN
util/__pycache__/ModelUtils.cpython-38.pyc Ver arquivo


BIN
util/__pycache__/TimeUtils.cpython-310.pyc Ver arquivo


BIN
util/__pycache__/TimeUtils.cpython-38.pyc Ver arquivo


BIN
util/__pycache__/YmlUtils.cpython-310.pyc Ver arquivo


BIN
util/__pycache__/YmlUtils.cpython-38.pyc Ver arquivo


BIN
util/__pycache__/__init__.cpython-310.pyc Ver arquivo


BIN
util/__pycache__/__init__.cpython-38.pyc Ver arquivo


Carregando…
Cancelar
Salvar