Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,7 @@ dist/
*.user
BiStudent.Server/seed/*.local.csv
BiStudent.Server/App_Data/

# Модель SFace скачивается при сборке (см. BiStudent.Core.csproj)
BiStudent.Core/Models/face_recognition_sface_2021dec.onnx
BiStudent.Core/Models/*.download
28 changes: 27 additions & 1 deletion BiStudent.Core/BiStudent.Core.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,35 @@
<ItemGroup>
<PackageReference Include="OpenCvSharp4" Version="4.13.0.20260627" />
</ItemGroup>

<!-- Модель SFace (38 МБ) не хранится в git: при первой сборке она скачивается из OpenCV Zoo и проверяется по SHA-256. -->
<PropertyGroup>
<ModelsDirectory>$(MSBuildThisFileDirectory)Models\</ModelsDirectory>
<SFaceModel>$(ModelsDirectory)face_recognition_sface_2021dec.onnx</SFaceModel>
<SFaceSha256>0BA9FBFA01B5270C96627C4EF784DA859931E02F04419C829E83484087C34E79</SFaceSha256>
<SFaceUrl>https://media.githubusercontent.com/media/opencv/opencv_zoo/main/models/face_recognition_sface/face_recognition_sface_2021dec.onnx</SFaceUrl>
<SFaceMirrorUrl>https://huggingface.co/opencv/face_recognition_sface/resolve/main/face_recognition_sface_2021dec.onnx</SFaceMirrorUrl>
</PropertyGroup>
<ItemGroup>
<None Include="Models\*.onnx" CopyToOutputDirectory="PreserveNewest" />
<None Include="Models\face_detection_yunet_2023mar.onnx" CopyToOutputDirectory="PreserveNewest" />
<None Include="Models\face_recognition_sface_2021dec.onnx" CopyToOutputDirectory="PreserveNewest" />
<None Include="Models\LICENSE-YUNET.txt" CopyToOutputDirectory="PreserveNewest" />
<None Include="Models\LICENSE-SFACE.txt" CopyToOutputDirectory="PreserveNewest" />
</ItemGroup>

<Target Name="DownloadSFaceModel" BeforeTargets="BeforeBuild" Condition="!Exists('$(SFaceModel)')">
<Message Importance="high" Text="BiStudent: скачиваю модель SFace (38 МБ) из OpenCV Zoo…" />
<DownloadFile SourceUrl="$(SFaceUrl)" DestinationFolder="$(ModelsDirectory)" DestinationFileName="face_recognition_sface_2021dec.onnx.download" Retries="3" RetryDelayMilliseconds="3000" ContinueOnError="true" />
<DownloadFile SourceUrl="$(SFaceMirrorUrl)" DestinationFolder="$(ModelsDirectory)" DestinationFileName="face_recognition_sface_2021dec.onnx.download" Retries="3" RetryDelayMilliseconds="3000" ContinueOnError="true"
Condition="!Exists('$(SFaceModel).download')" />
<Error Condition="!Exists('$(SFaceModel).download')"
Text="Не удалось скачать модель SFace. Скачайте её вручную по адресу $(SFaceUrl) и положите в $(SFaceModel)." />
<GetFileHash Files="$(SFaceModel).download" Algorithm="SHA256">
<Output TaskParameter="Hash" PropertyName="DownloadedSFaceHash" />
</GetFileHash>
<Delete Files="$(SFaceModel).download" Condition="'$(DownloadedSFaceHash)' != '$(SFaceSha256)'" />
<Error Condition="'$(DownloadedSFaceHash)' != '$(SFaceSha256)'"
Text="Скачанная модель SFace не совпадает по SHA-256 (получено $(DownloadedSFaceHash), ожидалось $(SFaceSha256))." />
<Move SourceFiles="$(SFaceModel).download" DestinationFiles="$(SFaceModel)" />
</Target>
</Project>
Binary file not shown.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@

Вход в клиент: сервер `http://localhost:5080`, логин `teacher`, пароль `teacher123`.

Модель распознавания SFace (38 МБ) не хранится в репозитории: при первой сборке её скачивает `BiStudent.Core.csproj` из OpenCV Zoo (запасной адрес — Hugging Face) и проверяет по SHA-256. Без интернета положите файл `face_recognition_sface_2021dec.onnx` в `BiStudent.Core/Models` вручную. Детектор YuNet (0,2 МБ) лежит в репозитории.

Запуск вручную:

```powershell
Expand Down
Loading