-
Couldn't load subscription status.
- Fork 2
image_quality_check #647
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
image_quality_check #647
Conversation
| 'image_size': image_size | ||
| }) | ||
| images_collection.insert_one(image.pack()) | ||
| print(str(check_id) + " " + str(caption)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Удалите отладочные комментари
| return None | ||
|
|
||
| def save_image_to_db(check_id, image_data, caption, image_size): | ||
| image = Image({ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
возможно, полезно будет сохранять ещё какую-то информацию об изображении (страница, где она расположена или другая информация, которая поможет найти это изображение в тексте?)
| image = Image({ | ||
| 'check_id': check_id, | ||
| 'image_data': image_data, | ||
| 'caption': caption, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
откуда берется подпись / что она из себя представляет? есть ли у всех изображений - или это подпись "Рис. 2 - ...", которую кто-то может не указать?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Да, это подпись "Рис. 2 - ..."
Подпись извлекается в файле docx_uploader.py в строках 273-285
| if self.laplacian_score < self.min_laplacian: | ||
| deny_list.append(f"Изображение с подписью '{img.caption}' имеет низкий показатель лапласиана: {self.laplacian_score} (минимум {self.min_laplacian}).<br>") | ||
|
|
||
| if self.entropy_score < self.min_entropy: | ||
| deny_list.append(f"Изображение с подписью '{img.caption}' имеет низкую энтропию: {self.entropy_score} (минимум {self.min_entropy}).<br>") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Рядовой студент точно не будет знать (или гуглить), кто такое лапласиан и энтропия - возможно, стоит сделать пояснение (= пользователь должен понять, что и как ему исправить)
| if self.entropy_score < self.min_entropy: | ||
| deny_list.append(f"Изображение с подписью '{img.caption}' имеет низкую энтропию: {self.entropy_score} (минимум {self.min_entropy}).<br>") | ||
| else: | ||
| return answer(False, 'Изображения не найдены!') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Гипотетически работа может быть без рисунков (и вроде как это не будет нарушением)
| check = Check({ | ||
| 'filename': basename(new_filepath), | ||
| }) | ||
|
|
||
| file_id = 0 | ||
| file = files_info_collection.find_one({'name': basename(new_filepath)}) | ||
| if file: | ||
| file_id = file['_id'] | ||
|
|
||
| check_id = add_check(file_id, check) | ||
| presentation.extract_images_with_captions(check_id) | ||
| file_object = presentation |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Не совсем понимаю происходящее, но проверки по имени файла (и затем поиск её по нему) - не подходит, поскольку студенты могут загружать файл с одним и тем же названием по несколько раз (при этом содержимое разное)
| check = Check({ | ||
| 'filename': basename(new_filepath), | ||
| }) | ||
|
|
||
| file_id = 0 | ||
| file = files_info_collection.find_one({'name': basename(new_filepath)}) | ||
| if file: | ||
| file_id = file['_id'] | ||
|
|
||
| check_id = add_check(file_id, check) | ||
| docx.parse() | ||
| docx.extract_images_with_captions(check_id) | ||
| file_object = docx |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
избавьтесь от дублирования кода (с блоком выше)
|
|
||
| # Извлечение бинарных данных изображения | ||
| image_streams = run._element.findall('.//a:blip', namespaces={ | ||
| 'a': 'http://schemas.openxmlformats.org/drawingml/2006/main'}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Правильно ли я понимаю, что 2006 тут и дальше - это год какого-то стандарта? не может ли в документе быть другого? (и вдруг мы что-то пропустим)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Да, 2006 в пространствах имен указывает на год, когда были определены стандарты Office Open XML.
Эти стандарты остаются актуальными и в более поздних версиях Office, включая Office 2016, Office 2019, Office 2021 и Microsoft 365, так что должны ничего не пропустить.
|
Перенесен в #656 |
No description provided.