Compare commits
2 Commits
4916198aab
...
fe3f81b0cb
Author | SHA1 | Date | |
---|---|---|---|
fe3f81b0cb | |||
e1e4704659 |
@ -1,24 +1,23 @@
|
||||
<component name="ProjectRunConfigurationManager">
|
||||
<configuration default="false" name="main (check)" type="PythonConfigurationType" factoryName="Python">
|
||||
<module name="VideoAnalysis-dnn"/>
|
||||
<option name="INTERPRETER_OPTIONS" value=""/>
|
||||
<option name="PARENT_ENVS" value="true"/>
|
||||
<envs>
|
||||
<env name="PYTHONUNBUFFERED" value="1"/>
|
||||
</envs>
|
||||
<option name="SDK_HOME" value=""/>
|
||||
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$"/>
|
||||
<option name="IS_MODULE_SDK" value="true"/>
|
||||
<option name="ADD_CONTENT_ROOTS" value="true"/>
|
||||
<option name="ADD_SOURCE_ROOTS" value="true"/>
|
||||
<option name="SCRIPT_NAME" value="$PROJECT_DIR$/main.py"/>
|
||||
<option name="PARAMETERS"
|
||||
value="2d147dcb-9c45-310b-a3ae-67d35a141755 "test-data/lectionAudi/2021-03-12 13-51-07.JPG""/>
|
||||
<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 default="false" name="main (check)" type="PythonConfigurationType" factoryName="Python">
|
||||
<module name="VideoAnalysis" />
|
||||
<option name="INTERPRETER_OPTIONS" value="" />
|
||||
<option name="PARENT_ENVS" value="true" />
|
||||
<envs>
|
||||
<env name="PYTHONUNBUFFERED" value="1" />
|
||||
</envs>
|
||||
<option name="SDK_HOME" value="" />
|
||||
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" />
|
||||
<option name="IS_MODULE_SDK" value="true" />
|
||||
<option name="ADD_CONTENT_ROOTS" value="true" />
|
||||
<option name="ADD_SOURCE_ROOTS" value="true" />
|
||||
<option name="SCRIPT_NAME" value="$PROJECT_DIR$/main.py" />
|
||||
<option name="PARAMETERS" value="5cc5570b-6ed9-3b33-9db4-bdb8ecb9f890 "test-data/lectionAudi/2021-03-12 13-51-07.JPG"" />
|
||||
<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>
|
||||
</component>
|
@ -1,24 +1,23 @@
|
||||
<component name="ProjectRunConfigurationManager">
|
||||
<configuration default="false" name="main (empty)" type="PythonConfigurationType" factoryName="Python">
|
||||
<module name="VideoAnalysis-dnn"/>
|
||||
<option name="INTERPRETER_OPTIONS" value=""/>
|
||||
<option name="PARENT_ENVS" value="true"/>
|
||||
<envs>
|
||||
<env name="PYTHONUNBUFFERED" value="1"/>
|
||||
</envs>
|
||||
<option name="SDK_HOME" value=""/>
|
||||
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$"/>
|
||||
<option name="IS_MODULE_SDK" value="true"/>
|
||||
<option name="ADD_CONTENT_ROOTS" value="true"/>
|
||||
<option name="ADD_SOURCE_ROOTS" value="true"/>
|
||||
<option name="SCRIPT_NAME" value="$PROJECT_DIR$/main.py"/>
|
||||
<option name="PARAMETERS"
|
||||
value="2d147dcb-9c45-310b-a3ae-67d35a141755 "test-data/lectionAudi/2021-03-12 13-49-32.JPG""/>
|
||||
<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 default="false" name="main (empty)" type="PythonConfigurationType" factoryName="Python">
|
||||
<module name="VideoAnalysis" />
|
||||
<option name="INTERPRETER_OPTIONS" value="" />
|
||||
<option name="PARENT_ENVS" value="true" />
|
||||
<envs>
|
||||
<env name="PYTHONUNBUFFERED" value="1" />
|
||||
</envs>
|
||||
<option name="SDK_HOME" value="" />
|
||||
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" />
|
||||
<option name="IS_MODULE_SDK" value="true" />
|
||||
<option name="ADD_CONTENT_ROOTS" value="true" />
|
||||
<option name="ADD_SOURCE_ROOTS" value="true" />
|
||||
<option name="SCRIPT_NAME" value="$PROJECT_DIR$/main.py" />
|
||||
<option name="PARAMETERS" value="5cc5570b-6ed9-3b33-9db4-bdb8ecb9f890 "test-data/lectionAudi/2021-03-12 13-49-32.JPG"" />
|
||||
<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>
|
||||
</component>
|
@ -1,24 +1,23 @@
|
||||
<component name="ProjectRunConfigurationManager">
|
||||
<configuration default="false" name="main (not empty)" type="PythonConfigurationType" factoryName="Python">
|
||||
<module name="VideoAnalysis-dnn"/>
|
||||
<option name="INTERPRETER_OPTIONS" value=""/>
|
||||
<option name="PARENT_ENVS" value="true"/>
|
||||
<envs>
|
||||
<env name="PYTHONUNBUFFERED" value="1"/>
|
||||
</envs>
|
||||
<option name="SDK_HOME" value=""/>
|
||||
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$"/>
|
||||
<option name="IS_MODULE_SDK" value="true"/>
|
||||
<option name="ADD_CONTENT_ROOTS" value="true"/>
|
||||
<option name="ADD_SOURCE_ROOTS" value="true"/>
|
||||
<option name="SCRIPT_NAME" value="$PROJECT_DIR$/main.py"/>
|
||||
<option name="PARAMETERS"
|
||||
value="2d147dcb-9c45-310b-a3ae-67d35a141755 "test-data/lectionAudi/2021-03-12 13-48-31.JPG""/>
|
||||
<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 default="false" name="main (not empty)" type="PythonConfigurationType" factoryName="Python">
|
||||
<module name="VideoAnalysis" />
|
||||
<option name="INTERPRETER_OPTIONS" value="" />
|
||||
<option name="PARENT_ENVS" value="true" />
|
||||
<envs>
|
||||
<env name="PYTHONUNBUFFERED" value="1" />
|
||||
</envs>
|
||||
<option name="SDK_HOME" value="" />
|
||||
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" />
|
||||
<option name="IS_MODULE_SDK" value="true" />
|
||||
<option name="ADD_CONTENT_ROOTS" value="true" />
|
||||
<option name="ADD_SOURCE_ROOTS" value="true" />
|
||||
<option name="SCRIPT_NAME" value="$PROJECT_DIR$/main.py" />
|
||||
<option name="PARAMETERS" value="5cc5570b-6ed9-3b33-9db4-bdb8ecb9f890 "test-data/lectionAudi/2021-03-12 13-48-31.JPG"" />
|
||||
<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>
|
||||
</component>
|
16
main.py
16
main.py
@ -22,7 +22,6 @@ def analyse_file(uid, image_path):
|
||||
raise Exception(f'Изображение {image_path} не существует')
|
||||
model = torch.hub.load('ultralytics/yolov5', 'yolov5s', pretrained=True)
|
||||
model.names = neuralNetwork.rename_entity(model.names)
|
||||
list_sqwrl = ontologyWorking.get_list_sqwrl(uid, url)
|
||||
|
||||
results = model(imageWorking.get_image_as_array(image_path))
|
||||
object_properties = list()
|
||||
@ -46,15 +45,16 @@ def analyse_file(uid, image_path):
|
||||
'QueryGetCheck': '',
|
||||
'QueryGetEmpty': ''
|
||||
}
|
||||
for sqwrl in list_sqwrl['response']:
|
||||
response = requests.post(url + f'{uid}/query/{sqwrl["name"]}', json=data).json()
|
||||
if response['error']:
|
||||
raise Exception(response['error'])
|
||||
result[sqwrl['name']] = [resultSQWRL['name']['value'] for resultSQWRL in response['response']['rows']]
|
||||
print(f'Запрос {sqwrl["name"]} выполнен')
|
||||
params = '&'.join([f'names={query}' for query in result.keys()])
|
||||
response = requests.post(url + f'{uid}/query/multi?{params}', json=data).json()
|
||||
if response['error']:
|
||||
raise Exception(response['error'])
|
||||
for query in response['response']:
|
||||
result[query] = [resultSQWRL['name']['value'] for resultSQWRL in response['response'][query]['rows']]
|
||||
print(f'Запрос выполнен')
|
||||
|
||||
print()
|
||||
print('Результаты')
|
||||
print('Результат:')
|
||||
if result['QueryGetNotEmpty']:
|
||||
print('Аудитория занята')
|
||||
elif result['QueryGetCheck']:
|
||||
|
@ -9,10 +9,6 @@ def is_ontology_exists(uid, url):
|
||||
return True
|
||||
|
||||
|
||||
def get_list_sqwrl(uid, url):
|
||||
return requests.get(url + f'{uid}/query/', verify=False).json()
|
||||
|
||||
|
||||
def get_entity_square(results_ndarray_i):
|
||||
square = float((results_ndarray_i[2] - results_ndarray_i[0]) *
|
||||
(results_ndarray_i[3] - results_ndarray_i[1]))
|
||||
|
Loading…
Reference in New Issue
Block a user