</mappings> | </mappings> | ||||
</serverdata> | </serverdata> | ||||
</paths> | </paths> | ||||
<paths name="10.22"> | |||||
<serverdata> | |||||
<mappings> | |||||
<mapping deploy="/home/th/tuo_heng/prod/tuoheng_alg" local="$PROJECT_DIR$" web="/" /> | |||||
</mappings> | |||||
</serverdata> | |||||
</paths> | |||||
<paths name="66"> | <paths name="66"> | ||||
<serverdata> | <serverdata> | ||||
<mappings> | <mappings> |
<configs> | <configs> | ||||
<sshConfig authType="PASSWORD" host="192.168.10.66" id="aa89844a-f7c0-47b6-9359-30d13fa76380" port="22" nameFormat="DESCRIPTIVE" username="thsw2" /> | <sshConfig authType="PASSWORD" host="192.168.10.66" id="aa89844a-f7c0-47b6-9359-30d13fa76380" port="22" nameFormat="DESCRIPTIVE" username="thsw2" /> | ||||
<sshConfig authType="PASSWORD" host="192.168.10.21" id="adf5e1da-4910-4668-bfbb-432f4e2ae77c" port="22" nameFormat="DESCRIPTIVE" username="th" /> | <sshConfig authType="PASSWORD" host="192.168.10.21" id="adf5e1da-4910-4668-bfbb-432f4e2ae77c" port="22" nameFormat="DESCRIPTIVE" username="th" /> | ||||
<sshConfig authType="PASSWORD" host="192.168.10.22" id="ac18a75e-ff42-4875-a5da-ad98d2d695ea" port="22" nameFormat="DESCRIPTIVE" username="th" /> | |||||
</configs> | </configs> | ||||
</component> | </component> | ||||
</project> | </project> |
</fileTransfer> | </fileTransfer> | ||||
</webServer> | </webServer> | ||||
<webServer id="c24476df-a574-465f-9529-a8e029b84f34" name="10.21"> | <webServer id="c24476df-a574-465f-9529-a8e029b84f34" name="10.21"> | ||||
<fileTransfer accessType="SFTP" host="192.168.10.21" port="22" sshConfigId="adf5e1da-4910-4668-bfbb-432f4e2ae77c" sshConfig="th@192.168.10.21:22 password"> | |||||
<fileTransfer accessType="SFTP" host="192.168.10.22" port="22" sshConfigId="ac18a75e-ff42-4875-a5da-ad98d2d695ea" sshConfig="th@192.168.10.22:22 password"> | |||||
<advancedOptions> | |||||
<advancedOptions dataProtectionLevel="Private" keepAliveTimeout="0" passiveMode="true" shareSSLContext="true" /> | |||||
</advancedOptions> | |||||
</fileTransfer> | |||||
</webServer> | |||||
<webServer id="575fb0f8-1aa4-4ab8-8952-1657964a0673" name="10.22"> | |||||
<fileTransfer accessType="SFTP" host="192.168.10.22" port="22" sshConfigId="ac18a75e-ff42-4875-a5da-ad98d2d695ea" sshConfig="th@192.168.10.22:22 password"> | |||||
<advancedOptions> | <advancedOptions> | ||||
<advancedOptions dataProtectionLevel="Private" keepAliveTimeout="0" passiveMode="true" shareSSLContext="true" /> | <advancedOptions dataProtectionLevel="Private" keepAliveTimeout="0" passiveMode="true" shareSSLContext="true" /> | ||||
</advancedOptions> | </advancedOptions> |
</component> | </component> | ||||
<component name="ChangeListManager"> | <component name="ChangeListManager"> | ||||
<list default="true" id="4f7dccd9-8f92-4a6e-90cc-33890d102263" name="Changes" comment="Changes"> | <list default="true" id="4f7dccd9-8f92-4a6e-90cc-33890d102263" name="Changes" comment="Changes"> | ||||
<change beforePath="$PROJECT_DIR$/.idea/deployment.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/deployment.xml" afterDir="false" /> | |||||
<change beforePath="$PROJECT_DIR$/.idea/sshConfigs.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/sshConfigs.xml" afterDir="false" /> | |||||
<change beforePath="$PROJECT_DIR$/.idea/webServers.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/webServers.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$/enums/ModelTypeEnum.py" beforeDir="false" afterPath="$PROJECT_DIR$/enums/ModelTypeEnum.py" afterDir="false" /> | |||||
<change beforePath="$PROJECT_DIR$/test/image/1.jpg" beforeDir="false" afterPath="$PROJECT_DIR$/test/image/1.jpg" afterDir="false" /> | |||||
<change beforePath="$PROJECT_DIR$/test/image/2.jpg" beforeDir="false" afterPath="$PROJECT_DIR$/test/image/2.jpg" afterDir="false" /> | |||||
<change beforePath="$PROJECT_DIR$/test/image/AI.jpg" beforeDir="false" /> | |||||
<change beforePath="$PROJECT_DIR$/test/image/AI1.jpg" beforeDir="false" /> | |||||
<change beforePath="$PROJECT_DIR$/test/image/AI2.jpg" beforeDir="false" /> | |||||
<change beforePath="$PROJECT_DIR$/test/image/AI3.jpg" beforeDir="false" /> | |||||
<change beforePath="$PROJECT_DIR$/test/image/AI4.jpg" beforeDir="false" /> | |||||
<change beforePath="$PROJECT_DIR$/test/image/AI5.jpg" beforeDir="false" /> | |||||
<change beforePath="$PROJECT_DIR$/test/image/AI6.jpg" beforeDir="false" /> | |||||
<change beforePath="$PROJECT_DIR$/test/image/AI7.jpg" beforeDir="false" /> | |||||
<change beforePath="$PROJECT_DIR$/test/image/AI8.jpg" beforeDir="false" /> | |||||
<change beforePath="$PROJECT_DIR$/test/str/test.py" beforeDir="false" afterPath="$PROJECT_DIR$/test/str/test.py" afterDir="false" /> | |||||
<change beforePath="$PROJECT_DIR$/test/水印/余弦相似度计算.py" beforeDir="false" afterPath="$PROJECT_DIR$/test/水印/余弦相似度计算.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" /> | |||||
</list> | </list> | ||||
<option name="SHOW_DIALOG" value="false" /> | <option name="SHOW_DIALOG" value="false" /> | ||||
<option name="HIGHLIGHT_CONFLICTS" value="true" /> | <option name="HIGHLIGHT_CONFLICTS" value="true" /> | ||||
<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/dsp/tuoheng_dsp" /> | |||||
<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)" /> | ||||
<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.producer_start1"> | |||||
<component name="RunManager" selected="Python.test"> | |||||
<configuration name="aa" type="PythonConfigurationType" factoryName="Python" temporary="true" nameIsGenerated="true"> | <configuration name="aa" 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="" /> | ||||
<envs> | <envs> | ||||
<env name="PYTHONUNBUFFERED" value="1" /> | <env name="PYTHONUNBUFFERED" value="1" /> | ||||
</envs> | </envs> | ||||
<option name="SDK_HOME" value="$PROJECT_DIR$/../../../software/anaconda/envs/test/python.exe" /> | |||||
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$/test/while" /> | |||||
<option name="SDK_HOME" value="D:\software\anaconda\envs\chenyukun\python.exe" /> | |||||
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$/test/str" /> | |||||
<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="$PROJECT_DIR$/test/while/test.py" /> | |||||
<option name="SCRIPT_NAME" value="$PROJECT_DIR$/test/str/test.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" /> | ||||
<list> | <list> | ||||
<item itemvalue="Python.mysqltest" /> | <item itemvalue="Python.mysqltest" /> | ||||
<item itemvalue="Python.producer_start" /> | <item itemvalue="Python.producer_start" /> | ||||
<item itemvalue="Python.test" /> | |||||
<item itemvalue="Python.aa" /> | <item itemvalue="Python.aa" /> | ||||
<item itemvalue="Python.ffmpeg33" /> | <item itemvalue="Python.ffmpeg33" /> | ||||
<item itemvalue="Python.producer_start1" /> | <item itemvalue="Python.producer_start1" /> | ||||
<item itemvalue="Python.test" /> | |||||
</list> | </list> | ||||
<recent_temporary> | <recent_temporary> | ||||
<list> | <list> | ||||
<item itemvalue="Python.test" /> | |||||
<item itemvalue="Python.producer_start1" /> | <item itemvalue="Python.producer_start1" /> | ||||
<item itemvalue="Python.aa" /> | <item itemvalue="Python.aa" /> | ||||
<item itemvalue="Python.ffmpeg33" /> | <item itemvalue="Python.ffmpeg33" /> | ||||
<item itemvalue="Python.producer_start" /> | <item itemvalue="Python.producer_start" /> | ||||
<item itemvalue="Python.test" /> | |||||
</list> | </list> | ||||
</recent_temporary> | </recent_temporary> | ||||
</component> | </component> | ||||
<workItem from="1672797232144" duration="25138000" /> | <workItem from="1672797232144" duration="25138000" /> | ||||
<workItem from="1672877597405" duration="5633000" /> | <workItem from="1672877597405" duration="5633000" /> | ||||
<workItem from="1672967214543" duration="2590000" /> | <workItem from="1672967214543" duration="2590000" /> | ||||
<workItem from="1673483697794" duration="13972000" /> | |||||
<workItem from="1674003653469" duration="751000" /> | |||||
<workItem from="1674089698944" duration="1180000" /> | |||||
<workItem from="1674174312546" duration="591000" /> | |||||
<workItem from="1674953245041" duration="2374000" /> | |||||
<workItem from="1675038738781" duration="20967000" /> | |||||
<workItem from="1675126111623" duration="613000" /> | |||||
</task> | </task> | ||||
<servers /> | <servers /> | ||||
</component> | </component> | ||||
</component> | </component> | ||||
<component name="com.intellij.coverage.CoverageDataManagerImpl"> | <component name="com.intellij.coverage.CoverageDataManagerImpl"> | ||||
<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$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$test.coverage" NAME="test 覆盖结果" MODIFIED="1669793778903" 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$test.coverage" NAME="test 覆盖结果" MODIFIED="1675048794635" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="true" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$/test/str" /> | |||||
<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="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$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$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" /> |
def process(frame): | def process(frame): | ||||
try: | try: | ||||
p_result, timeOut = frame[1].process(copy.deepcopy(frame[0].get("frame")), int(frame[0].get("width") / 2)) | |||||
width = int(frame[0].get("width")) | |||||
if width > 1600: | |||||
width = width // 2 | |||||
p_result, timeOut = frame[1].process(copy.deepcopy(frame[0].get("frame")), width) | |||||
if frame[2]["video"]["video_add_water"]: | if frame[2]["video"]["video_add_water"]: | ||||
frame[0]["frame"] = frame[3].common_water_1(frame[0].get("frame"), frame[3].logo) | frame[0]["frame"] = frame[3].common_water_1(frame[0].get("frame"), frame[3].logo) | ||||
p_result[1] = frame[3].common_water_1(p_result[1], frame[3].logo) | p_result[1] = frame[3].common_water_1(p_result[1], frame[3].logo) | ||||
logger.info("######################开始加载模型######################") | logger.info("######################开始加载模型######################") | ||||
model_config = { | model_config = { | ||||
# 加载河道模型 | # 加载河道模型 | ||||
ModelType.WATER_SURFACE_MODEL.value[1]: (lambda x, y, z, r: ModelUtils.SZModel(x, y, z, r), ModelType.WATER_SURFACE_MODEL.value[1]), | |||||
ModelType.WATER_SURFACE_MODEL.value[1]: (lambda x, y, z, r: ModelUtils.Model(x, y, z, r, ModelType.WATER_SURFACE_MODEL), ModelType.WATER_SURFACE_MODEL.value[1]), | |||||
# 加载林场模型 | # 加载林场模型 | ||||
ModelType.FOREST_FARM_MODEL.value[1]: (lambda x, y, z, r: ModelUtils.LCModel(x, y, z, r), ModelType.FOREST_FARM_MODEL.value[1]), | |||||
ModelType.FOREST_FARM_MODEL.value[1]: (lambda x, y, z, r: ModelUtils.Model(x, y, z, r, ModelType.FOREST_FARM_MODEL), ModelType.FOREST_FARM_MODEL.value[1]), | |||||
# 加载交通模型 | # 加载交通模型 | ||||
ModelType.TRAFFIC_FARM_MODEL.value[1]: (lambda x, y, z, r: ModelUtils.RFModel(x, y, z, r), ModelType.TRAFFIC_FARM_MODEL.value[1]), | |||||
ModelType.TRAFFIC_FARM_MODEL.value[1]: (lambda x, y, z, r: ModelUtils.Model(x, y, z, r, ModelType.TRAFFIC_FARM_MODEL), ModelType.TRAFFIC_FARM_MODEL.value[1]), | |||||
# 加载防疫模型 | # 加载防疫模型 | ||||
ModelType.EPIDEMIC_PREVENTION_MODEL.value[1]: (lambda x, y, z, r: ModelUtils.IMModel(x, y, z, r), ModelType.EPIDEMIC_PREVENTION_MODEL.value[1]), | |||||
ModelType.EPIDEMIC_PREVENTION_MODEL.value[1]: (lambda x, y, z, r: ModelUtils.IMModel(x, y, z, r, ModelType.EPIDEMIC_PREVENTION_MODEL), ModelType.EPIDEMIC_PREVENTION_MODEL.value[1]), | |||||
# 加载车牌模型 | # 加载车牌模型 | ||||
ModelType.PLATE_MODEL.value[1]: (lambda x, y, z, r: ModelUtils.PlateMModel(x, y, z, r), ModelType.PLATE_MODEL.value[1]), | |||||
ModelType.PLATE_MODEL.value[1]: (lambda x, y, z, r: ModelUtils.IMModel(x, y, z, r, ModelType.PLATE_MODEL), ModelType.PLATE_MODEL.value[1]), | |||||
# 加载车辆模型 | # 加载车辆模型 | ||||
ModelType.Vehicle_MODEL.value[1]: (lambda x, y, z, r: ModelUtils.VehicleModel(x, y, z, r), ModelType.Vehicle_MODEL.value[1]), | |||||
ModelType.VEHICLE_MODEL.value[1]: (lambda x, y, z, r: ModelUtils.Model(x, y, z, r, ModelType.VEHICLE_MODEL), ModelType.VEHICLE_MODEL.value[1]), | |||||
# 加载行人模型 | # 加载行人模型 | ||||
ModelType.Pedestrian_MODEL.value[1]: (lambda x, y, z, r: ModelUtils.PedestrianModel(x, y, z, r), ModelType.Pedestrian_MODEL.value[1]), | |||||
ModelType.PEDESTRIAN_MODEL.value[1]: (lambda x, y, z, r: ModelUtils.Model(x, y, z, r, ModelType.PEDESTRIAN_MODEL), ModelType.PEDESTRIAN_MODEL.value[1]), | |||||
# 加载烟火模型 | # 加载烟火模型 | ||||
ModelType.Smogfire_MODEL.value[1]: (lambda x, y, z, r: ModelUtils.SmogfireModel(x, y, z, r), ModelType.Smogfire_MODEL.value[1]) | |||||
ModelType.SMOGFIRE_MODEL.value[1]: (lambda x, y, z, r: ModelUtils.Model(x, y, z, r, ModelType.SMOGFIRE_MODEL), ModelType.SMOGFIRE_MODEL.value[1]), | |||||
# 加载钓鱼游泳模型 | |||||
ModelType.ANGLERSWIMMER_MODEL.value[1]: (lambda x, y, z, r: ModelUtils.Model(x, y, z, r, ModelType.ANGLERSWIMMER_MODEL), ModelType.ANGLERSWIMMER_MODEL.value[1]), | |||||
# 加载乡村模型 | |||||
ModelType.COUNTRYROAD_MODEL.value[1]: (lambda x, y, z, r: ModelUtils.Model(x, y, z, r, ModelType.COUNTRYROAD_MODEL), ModelType.COUNTRYROAD_MODEL.value[1]) | |||||
} | } | ||||
for model in args[1]: | for model in args[1]: | ||||
try: | try: |
@unique | @unique | ||||
class ModelType(Enum): | class ModelType(Enum): | ||||
WATER_SURFACE_MODEL = ("1", "001", "河道模型") | |||||
WATER_SURFACE_MODEL = ("1", "001", "河道模型", 'river') | |||||
FOREST_FARM_MODEL = ("2", "002", "森林模型") | |||||
FOREST_FARM_MODEL = ("2", "002", "森林模型", 'forest') | |||||
TRAFFIC_FARM_MODEL = ("3", "003", "交通模型") | |||||
TRAFFIC_FARM_MODEL = ("3", "003", "交通模型", 'road') | |||||
EPIDEMIC_PREVENTION_MODEL = ("4", "004", "防疫模型") | |||||
EPIDEMIC_PREVENTION_MODEL = ("4", "004", "防疫模型", None) | |||||
PLATE_MODEL = ("5", "005", "车牌模型") | |||||
PLATE_MODEL = ("5", "005", "车牌模型", None) | |||||
Vehicle_MODEL = ("6", "006", "车辆模型") | |||||
VEHICLE_MODEL = ("6", "006", "车辆模型", 'vehicle') | |||||
Pedestrian_MODEL = ("7", "007", "行人模型") | |||||
PEDESTRIAN_MODEL = ("7", "007", "行人模型", 'pedestrian') | |||||
Smogfire_MODEL = ("8", "008", "烟火模型") | |||||
SMOGFIRE_MODEL = ("8", "008", "烟火模型", 'smogfire') | |||||
ANGLERSWIMMER_MODEL = ("9", "009", "钓鱼游泳模型", 'AnglerSwimmer') | |||||
COUNTRYROAD_MODEL = ("10", "010", "乡村模型", 'countryRoad') | |||||
def checkCode(code): | def checkCode(code): | ||||
for model in ModelType: | for model in ModelType: |
# else: | # else: | ||||
# a = '%s,%s' % (a, str(i)) | # a = '%s,%s' % (a, str(i)) | ||||
# print(a) | # print(a) | ||||
a=[1,2,3,4,5,8, 9] | |||||
b=[1,3,2] | |||||
if set(a) >= set(b): | |||||
print("a") | |||||
# a=[1,2,3,4,5,8, 9] | |||||
# b=[1,3,2] | |||||
# if set(a) >= set(b): | |||||
# print("a") | |||||
# else: | |||||
# print("b") | |||||
from enums.ModelTypeEnum import ModelType | |||||
if ModelType.WATER_SURFACE_MODEL == ModelType.FOREST_FARM_MODEL: | |||||
print("aaaaa") | |||||
else: | else: | ||||
print("b") | |||||
print("bbbbbbbbbb") | |||||
if isinstance(ModelType.WATER_SURFACE_MODEL, ModelType): | |||||
print("aaaaa") | |||||
else: | |||||
print("bbbbbbbbbb") | |||||
if type(ModelType.WATER_SURFACE_MODEL)==ModelType.FOREST_FARM_MODEL: | |||||
print("aaaaa") | |||||
else: | |||||
print("bbbbbbbbbb") |
if __name__ == '__main__': | if __name__ == '__main__': | ||||
# 把图片表示成一个向量,通过计算向量之间的余弦距离来表征两张图片的相似度 0.9760 | # 把图片表示成一个向量,通过计算向量之间的余弦距离来表征两张图片的相似度 0.9760 | ||||
image1 = cv2.imread('image/1.jpg') | |||||
image2 = cv2.imread('image/1.jpg') | |||||
image1 = cv2.imread('../image/1.jpg') | |||||
image2 = cv2.imread('../image/2.jpg') | |||||
# image3 = cv2.imread('image/AI2.jpg') | # image3 = cv2.imread('image/AI2.jpg') | ||||
# image4 = cv2.imread('image/AI3.jpg') | # image4 = cv2.imread('image/AI3.jpg') | ||||
# image5 = cv2.imread('image/AI4.jpg') | # image5 = cv2.imread('image/AI4.jpg') | ||||
dist = Hamming_distance(hash1, hash2) | dist = Hamming_distance(hash1, hash2) | ||||
#将距离转化为相似度 | #将距离转化为相似度 | ||||
similarity = 1 - dist * 1.0 / 64 | similarity = 1 - dist * 1.0 / 64 | ||||
print(dist) | |||||
# print(dist) | |||||
print(similarity, time.time() - start) | print(similarity, time.time() - start) | ||||
# cosin = image_similarity_vectors_via_numpy(image1, image2) | # cosin = image_similarity_vectors_via_numpy(image1, image2) | ||||
# print('图片余弦相似度', cosin) | # print('图片余弦相似度', cosin) |
self.fps = fps | self.fps = fps | ||||
self.width = width | self.width = width | ||||
self.height = height | self.height = height | ||||
self.wh = int(width * height * 3 // 8) | |||||
self.wah = '%sx%s' % (int(self.width / 2), int(self.height / 2)) | |||||
self.h = int(self.height * 3 // 4) | |||||
self.w = int(self.width // 2) | |||||
self.hn = int(self.height // 2) | |||||
self.wn = int(self.width // 2) | |||||
w_f = self.wh != width * height * 3 / 8 | |||||
h_f = self.h != self.height * 3 / 4 | |||||
wd_f = self.w != self.width / 2 | |||||
if w_f or h_f or wd_f: | |||||
self.resize_status = True | |||||
if width > 1600: | |||||
self.wh = int(width * height * 3 // 8) | |||||
self.wah = '%sx%s' % (int(self.width / 2), int(self.height / 2)) | |||||
self.h = int(self.height * 3 // 4) | |||||
self.w = int(self.width // 2) | |||||
self.hn = int(self.height // 2) | |||||
self.wn = int(self.width // 2) | |||||
w_f = self.wh != width * height * 3 / 8 | |||||
h_f = self.h != self.height * 3 / 4 | |||||
wd_f = self.w != self.width / 2 | |||||
if w_f or h_f or wd_f: | |||||
self.resize_status = True | |||||
self.wh = int(width * height * 3 // 2) | |||||
self.wah = '%sx%s' % (int(self.width), int(self.height)) | |||||
self.h = int(self.height * 3 // 2) | |||||
self.w = int(self.width) | |||||
else: | |||||
self.wh = int(width * height * 3 // 2) | self.wh = int(width * height * 3 // 2) | ||||
self.wah = '%sx%s' % (int(self.width), int(self.height)) | self.wah = '%sx%s' % (int(self.width), int(self.height)) | ||||
self.h = int(self.height * 3 // 2) | self.h = int(self.height * 3 // 2) | ||||
self.w = int(self.width) | self.w = int(self.width) | ||||
self.hn = int(self.height) | |||||
self.wn = int(self.width) | |||||
''' | ''' | ||||
获取视频信息 | 获取视频信息 | ||||
fps = video_stream.get('r_frame_rate') | fps = video_stream.get('r_frame_rate') | ||||
# duration = video_stream.get('duration') | # duration = video_stream.get('duration') | ||||
bit_rate = video_stream.get('bit_rate') | bit_rate = video_stream.get('bit_rate') | ||||
if width: | |||||
self.width = int(width) | |||||
if height: | |||||
self.height = int(height) | |||||
self.width = int(width) | |||||
self.height = int(height) | |||||
if width is not None and height is not None: | if width is not None and height is not None: | ||||
self.wh = int(width * height * 3 // 8) | |||||
self.wah = '%sx%s' % (int(self.width / 2), int(self.height / 2)) | |||||
self.h = int(self.height * 3 // 4) | |||||
self.w = int(self.width / 2) | |||||
self.hn = int(self.height / 2) | |||||
self.wn = int(self.width // 2) | |||||
w_f = self.wh != width * height * 3 / 8 | |||||
h_f = self.h != self.height * 3 / 4 | |||||
wd_f = self.w != self.width / 2 | |||||
if w_f or h_f or wd_f: | |||||
self.resize_status = True | |||||
if width > 1600: | |||||
self.wh = int(width * height * 3 // 8) | |||||
self.wah = '%sx%s' % (int(self.width / 2), int(self.height / 2)) | |||||
self.h = int(self.height * 3 // 4) | |||||
self.w = int(self.width / 2) | |||||
self.hn = int(self.height / 2) | |||||
self.wn = int(self.width // 2) | |||||
w_f = self.wh != width * height * 3 / 8 | |||||
h_f = self.h != self.height * 3 / 4 | |||||
wd_f = self.w != self.width / 2 | |||||
if w_f or h_f or wd_f: | |||||
self.resize_status = True | |||||
self.wh = int(width * height * 3 // 2) | |||||
self.wah = '%sx%s' % (int(self.width), int(self.height)) | |||||
self.h = int(self.height * 3 // 2) | |||||
self.w = int(self.width) | |||||
else: | |||||
self.wh = int(width * height * 3 // 2) | self.wh = int(width * height * 3 // 2) | ||||
self.wah = '%sx%s' % (int(self.width), int(self.height)) | self.wah = '%sx%s' % (int(self.width), int(self.height)) | ||||
self.h = int(self.height * 3 // 2) | self.h = int(self.height * 3 // 2) | ||||
self.w = int(self.width) | self.w = int(self.width) | ||||
self.hn = int(self.height) | |||||
self.wn = int(self.width) | |||||
if nb_frames: | if nb_frames: | ||||
self.all_frames = int(nb_frames) | self.all_frames = int(nb_frames) | ||||
if fps: | if fps: | ||||
ExceptionType.VIDEO_RESOLUTION_EXCEPTION.value[1]) | ExceptionType.VIDEO_RESOLUTION_EXCEPTION.value[1]) | ||||
result = cv2.cvtColor(img, cv2.COLOR_YUV2BGR_NV12) | result = cv2.cvtColor(img, cv2.COLOR_YUV2BGR_NV12) | ||||
if self.resize_status: | if self.resize_status: | ||||
result = cv2.resize(result, (int(self.width / 2), int(self.height / 2)), | |||||
interpolation=cv2.INTER_LINEAR) | |||||
if self.width > 1600: | |||||
result = cv2.resize(result, (int(self.width / 2), int(self.height / 2)), | |||||
interpolation=cv2.INTER_LINEAR) | |||||
except ServiceException as s: | except ServiceException as s: | ||||
raise s | raise s | ||||
except Exception as e: | except Exception as e: | ||||
logger.error("推流地址不能为空, requestId:{}", self.requestId) | logger.error("推流地址不能为空, requestId:{}", self.requestId) | ||||
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]) | ||||
width = int(self.width) | |||||
if width <= 1600: | |||||
width = 2 * int(self.width) | |||||
command = ['ffmpeg', | command = ['ffmpeg', | ||||
# '-loglevel', 'debug', | # '-loglevel', 'debug', | ||||
'-y', | '-y', | ||||
'-pix_fmt', 'bgr24', | '-pix_fmt', 'bgr24', | ||||
'-thread_queue_size', '1024', | '-thread_queue_size', '1024', | ||||
# '-s', "{}x{}".format(self.width * 2, self.height), | # '-s', "{}x{}".format(self.width * 2, self.height), | ||||
'-s', "{}x{}".format(int(self.width), int(self.hn)), | |||||
'-s', "{}x{}".format(width, int(self.hn)), | |||||
'-r', str(self.fps), | '-r', str(self.fps), | ||||
'-i', '-', # 指定输入文件 | '-i', '-', # 指定输入文件 | ||||
'-g', str(self.fps), | '-g', str(self.fps), | ||||
# '-maxrate', '15000k', | |||||
'-maxrate', '8000k', | |||||
# '-profile:v', 'high', | # '-profile:v', 'high', | ||||
# '-b:v', '4000k', | |||||
'-b:v', '5000k', | |||||
# '-crf', '18', | # '-crf', '18', | ||||
'-rc:v', 'vbr', | |||||
'-cq:v', '30', | |||||
'-qmin', '30', | |||||
'-qmax', '30', | |||||
# '-rc:v', 'vbr', | |||||
# '-cq:v', '25', | |||||
# '-qmin', '25', | |||||
# '-qmax', '25', | |||||
'-c:v', 'h264_nvenc', # | '-c:v', 'h264_nvenc', # | ||||
# '-bufsize', '4000k', | |||||
'-bufsize', '5000k', | |||||
# '-c:v', 'libx264', # 指定视频编码器 | # '-c:v', 'libx264', # 指定视频编码器 | ||||
# '-tune', 'zerolatency', # 加速编码速度 | # '-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', 'fast', # 指定输出的视频质量,会影响文件的生成速度,有以下几个可用的值 ultrafast, | |||||
# superfast, veryfast, faster, fast, medium, slow, slower, veryslow。 | |||||
# '-preset', 'fast', # 指定输出的视频质量,会影响文件的生成速度,有以下几个可用的值 ultrafast, | |||||
'-preset', 'p6', # 指定输出的视频质量,会影响文件的生成速度,有以下几个可用的值 ultrafast, | |||||
'-tune', 'll', | |||||
'-f', 'flv', | '-f', 'flv', | ||||
self.pushUrl] | self.pushUrl] | ||||
# command = 'ffmpeg -loglevel debug -y -f rawvideo -vcodec rawvideo -pix_fmt bgr24' +\ | # command = 'ffmpeg -loglevel debug -y -f rawvideo -vcodec rawvideo -pix_fmt bgr24' +\ |