Browse Source

更新图片帧数值浮点改int类型

pull/1/head
chenyukun 2 years ago
parent
commit
fd93c51be9
4 changed files with 139 additions and 21 deletions
  1. +2
    -4
      .idea/deployment.xml
  2. +6
    -0
      .idea/encodings.xml
  3. +120
    -6
      .idea/workspace.xml
  4. +11
    -11
      concurrency/IntelligentRecognitionProcess.py

+ 2
- 4
.idea/deployment.xml View File

@@ -5,16 +5,14 @@
<paths name="66">
<serverdata>
<mappings>
<mapping deploy="/home/DATA/chenyukun/algSch" local="$PROJECT_DIR$" web="/" />
<mapping local="" />
<mapping local="$PROJECT_DIR$" web="/" />
</mappings>
</serverdata>
</paths>
<paths name="chenyukun">
<serverdata>
<mappings>
<mapping deploy="/opt/ai/algSch" local="$PROJECT_DIR$" web="/" />
<mapping deploy="" local="" />
<mapping local="$PROJECT_DIR$" web="/" />
</mappings>
</serverdata>
</paths>

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

@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="Encoding">
<file url="PROJECT" charset="UTF-8" />
</component>
</project>

+ 120
- 6
.idea/workspace.xml View File

@@ -5,9 +5,9 @@
</component>
<component name="ChangeListManager">
<list default="true" id="4f7dccd9-8f92-4a6e-90cc-33890d102263" name="Changes" comment="">
<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$/service/Dispatcher.py" beforeDir="false" afterPath="$PROJECT_DIR$/service/Dispatcher.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/util/Cv2Utils.py" beforeDir="false" afterPath="$PROJECT_DIR$/util/Cv2Utils.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/concurrency/IntelligentRecognitionProcess.py" beforeDir="false" afterPath="$PROJECT_DIR$/concurrency/IntelligentRecognitionProcess.py" afterDir="false" />
</list>
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
@@ -62,6 +62,11 @@
</map>
</branch-storage>
</favorite-branches>
<option name="RECENT_BRANCH_BY_REPOSITORY">
<map>
<entry key="$PROJECT_DIR$" value="master" />
</map>
</option>
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
</component>
<component name="GitSEFilterConfiguration">
@@ -81,12 +86,12 @@
<option name="branches">
<list>
<RecentBranch>
<option name="branchName" value="develop" />
<option name="lastUsedInstant" value="1661935643" />
<option name="branchName" value="release" />
<option name="lastUsedInstant" value="1664245931" />
</RecentBranch>
<RecentBranch>
<option name="branchName" value="master" />
<option name="lastUsedInstant" value="1661935477" />
<option name="lastUsedInstant" value="1664245924" />
</RecentBranch>
</list>
</option>
@@ -152,6 +157,50 @@
</key>
</component>
<component name="RunManager" selected="Python.read">
<configuration default="true" type="DjangoTestsConfigurationType">
<option name="INTERPRETER_OPTIONS" value="" />
<option name="PARENT_ENVS" value="true" />
<envs>
<env name="PYTHONUNBUFFERED" value="1" />
</envs>
<option name="SDK_HOME" value="" />
<option name="WORKING_DIRECTORY" value="" />
<option name="IS_MODULE_SDK" value="false" />
<option name="ADD_CONTENT_ROOTS" value="true" />
<option name="ADD_SOURCE_ROOTS" value="true" />
<module name="" />
<EXTENSION ID="PythonCoverageRunConfigurationExtension" runner="coverage.py" />
<option name="TARGET" value="" />
<option name="SETTINGS_FILE" value="" />
<option name="CUSTOM_SETTINGS" value="false" />
<option name="USE_OPTIONS" value="false" />
<option name="OPTIONS" value="" />
<method v="2" />
</configuration>
<configuration default="true" type="JetRunConfigurationType">
<method v="2">
<option name="Make" enabled="true" />
</method>
</configuration>
<configuration default="true" type="KotlinStandaloneScriptRunConfigurationType">
<option name="filePath" />
<method v="2">
<option name="Make" enabled="true" />
</method>
</configuration>
<configuration default="true" type="PyBehaveRunConfigurationType" factoryName="Behave">
<option name="INTERPRETER_OPTIONS" value="" />
<option name="PARENT_ENVS" value="true" />
<option name="SDK_HOME" value="" />
<option name="WORKING_DIRECTORY" value="" />
<option name="IS_MODULE_SDK" value="true" />
<option name="ADD_CONTENT_ROOTS" value="true" />
<option name="ADD_SOURCE_ROOTS" value="true" />
<module name="" />
<EXTENSION ID="PythonCoverageRunConfigurationExtension" runner="coverage.py" />
<option name="ADDITIONAL_ARGS" value="" />
<method v="2" />
</configuration>
<configuration name="ImageUtils" type="PythonConfigurationType" factoryName="Python" temporary="true" nameIsGenerated="true">
<module name="tuoheng_alg" />
<option name="INTERPRETER_OPTIONS" value="" />
@@ -218,6 +267,28 @@
<option name="INPUT_FILE" value="" />
<method v="2" />
</configuration>
<configuration default="true" type="PythonConfigurationType" factoryName="Python">
<option name="INTERPRETER_OPTIONS" value="" />
<option name="PARENT_ENVS" value="true" />
<envs>
<env name="PYTHONUNBUFFERED" value="1" />
</envs>
<option name="SDK_HOME" value="" />
<option name="WORKING_DIRECTORY" value="" />
<option name="IS_MODULE_SDK" value="false" />
<option name="ADD_CONTENT_ROOTS" value="true" />
<option name="ADD_SOURCE_ROOTS" value="true" />
<module name="" />
<EXTENSION ID="PythonCoverageRunConfigurationExtension" runner="coverage.py" />
<option name="SCRIPT_NAME" value="" />
<option name="PARAMETERS" value="" />
<option name="SHOW_COMMAND_LINE" value="false" />
<option name="EMULATE_TERMINAL" value="false" />
<option name="MODULE_MODE" value="false" />
<option name="REDIRECT_INPUT" value="false" />
<option name="INPUT_FILE" value="" />
<method v="2" />
</configuration>
<configuration name="mysqltest" type="PythonConfigurationType" factoryName="Python" nameIsGenerated="true">
<module name="tuoheng_alg" />
<option name="INTERPRETER_OPTIONS" value="" />
@@ -284,6 +355,49 @@
<option name="INPUT_FILE" value="" />
<method v="2" />
</configuration>
<configuration default="true" type="Python.FlaskServer">
<option name="INTERPRETER_OPTIONS" value="" />
<option name="PARENT_ENVS" value="true" />
<option name="SDK_HOME" value="" />
<option name="WORKING_DIRECTORY" value="" />
<option name="IS_MODULE_SDK" value="false" />
<option name="ADD_CONTENT_ROOTS" value="true" />
<option name="ADD_SOURCE_ROOTS" value="true" />
<module name="" />
<EXTENSION ID="PythonCoverageRunConfigurationExtension" runner="coverage.py" />
<option name="launchJavascriptDebuger" value="false" />
<method v="2" />
</configuration>
<configuration default="true" type="Tox" factoryName="Tox">
<option name="INTERPRETER_OPTIONS" value="" />
<option name="PARENT_ENVS" value="true" />
<option name="SDK_HOME" value="" />
<option name="WORKING_DIRECTORY" value="" />
<option name="IS_MODULE_SDK" value="false" />
<option name="ADD_CONTENT_ROOTS" value="true" />
<option name="ADD_SOURCE_ROOTS" value="true" />
<EXTENSION ID="PythonCoverageRunConfigurationExtension" runner="coverage.py" />
<method v="2" />
</configuration>
<configuration default="true" type="tests" factoryName="Doctests">
<option name="INTERPRETER_OPTIONS" value="" />
<option name="PARENT_ENVS" value="true" />
<option name="SDK_HOME" value="" />
<option name="WORKING_DIRECTORY" value="" />
<option name="IS_MODULE_SDK" value="false" />
<option name="ADD_CONTENT_ROOTS" value="true" />
<option name="ADD_SOURCE_ROOTS" value="true" />
<module name="" />
<EXTENSION ID="PythonCoverageRunConfigurationExtension" runner="coverage.py" />
<option name="SCRIPT_NAME" value="" />
<option name="CLASS_NAME" value="" />
<option name="METHOD_NAME" value="" />
<option name="FOLDER_NAME" value="" />
<option name="TEST_TYPE" value="TEST_SCRIPT" />
<option name="PATTERN" value="" />
<option name="USE_PATTERN" value="false" />
<method v="2" />
</configuration>
<list>
<item itemvalue="Python.mysqltest" />
<item itemvalue="Python.KafkaUtils" />
@@ -297,8 +411,8 @@
<item itemvalue="Python.read" />
<item itemvalue="Python.ImageUtils" />
<item itemvalue="Python.producer_start" />
<item itemvalue="Python.KafkaUtils" />
<item itemvalue="Python.KafkaUtils (1)" />
<item itemvalue="Python.KafkaUtils" />
</list>
</recent_temporary>
</component>

+ 11
- 11
concurrency/IntelligentRecognitionProcess.py View File

@@ -248,7 +248,7 @@ class OnlineIntelligentRecognitionProcess(IntelligentRecognitionProcess):
logger.exception("构建p管道重试失败:{}, requestId: {}", e, self.msg.get("request_id"))
break
# # 问题图片加入队列, 暂时写死,后期修改为真实问题
cf = cv2tool.cap.get(1)
cf = int(cv2tool.cap.get(1))
if p_result[2] is not None and len(p_result[2]) > 0:
for ai_analyse_result in p_result[2]:
order = str(int(ai_analyse_result[0]))
@@ -382,7 +382,7 @@ class OfflineIntelligentRecognitionProcess(IntelligentRecognitionProcess):
# 总视频帧数
all_f = None
if cv2tool.cap is not None:
all_f = cv2tool.cap.get(7)
all_f = int(cv2tool.cap.get(7))
while True:
end_time = time.time()
create_task_time = end_time - start_time
@@ -409,13 +409,13 @@ class OfflineIntelligentRecognitionProcess(IntelligentRecognitionProcess):
cv2_init_num += 1
time.sleep(1)
cv2tool.build_cv2()
all_f = cv2tool.cap.get(7)
all_f = int(cv2tool.cap.get(7))
continue
start_read_time = time.time()
is_opened, frame = cv2tool.cap.read()
cf = cv2tool.cap.get(1)
cf = int(cv2tool.cap.get(1))
if is_opened is None or not is_opened:
logger.info("总帧数: {}, 当前帧数: {}, requestId: {}, is_opened: {}", float(cv2tool.cap.get(7)),
logger.info("总帧数: {}, 当前帧数: {}, requestId: {}, is_opened: {}", cv2tool.cap.get(7),
cv2tool.cap.get(1), self.msg.get("request_id"), is_opened)
logger.info("离线读流结束,读流时间: {}", time.time() - start_read_time)
if float(cf) < float(all_f):
@@ -458,7 +458,7 @@ class OfflineIntelligentRecognitionProcess(IntelligentRecognitionProcess):
logger.exception("构建p管道重试失败:{}, requestId: {}", e, self.msg.get("request_id"))
break
# # 问题图片加入队列, 暂时写死,后期修改为真实问题
if int(cf) % 400 == 0:
if cf % 400 == 0:
hbQueue.put({"cf": cf, "af": all_f})
if p_result[2] is not None and len(p_result[2]) > 0:
for ai_analyse_result in p_result[2]:
@@ -469,8 +469,8 @@ class OfflineIntelligentRecognitionProcess(IntelligentRecognitionProcess):
high_score_image[order] = {
"or_frame": frame,
"ai_frame": p_result[1],
"current_frame": int(cf),
"last_frame": int(cf) + step,
"current_frame": cf,
"last_frame": cf + step,
"progress": "",
"mode_service": "offline",
"model_type_code": model_type_code,
@@ -482,15 +482,15 @@ class OfflineIntelligentRecognitionProcess(IntelligentRecognitionProcess):
high_score_image[order] = {
"or_frame": frame,
"ai_frame": p_result[1],
"current_frame": int(cf),
"last_frame": int(cf) + step,
"current_frame": cf,
"last_frame": cf + step,
"progress": "",
"mode_service": "offline",
"model_type_code": model_type_code,
"model_detection_code": order,
"socre": conf_c
}
if int(cf) % step == 0 and len(high_score_image) > 0:
if cf % step == 0 and len(high_score_image) > 0:
for value in high_score_image.values():
self.imageQueue.put({"image": value})
hbQueue.put({"cf": cf, "af": all_f})

Loading…
Cancel
Save