mirror of
https://github.com/babalae/better-genshin-impact.git
synced 2026-04-16 21:09:22 +08:00
* 使用TorchSharp重写RodNet,以利后续优化 * 增加一个外部torch加载配置来代替直接的依赖,如配置不生效则使用原先手搓的算法 * BgiOnnxFactory取消单例,改为在App服务类中注册为单例,由此修复了一堆单元测试 * BgiOnnxFactory中几个静态方法改为成员方法以和App解耦;因不再有多个mat源供消耗,FishBite中文字块算法不再改动传入的mat,使得后续串联的算法不受其影响 * 将BehavioursTests中临时的配置读取方式改为读取主项目编译环境中的json文件;新建单元测试的README * 将RodNet算法更新到010006a44c的版本;RodNet中关于torch库推理和直接数学计算的校验移至单元测试 * 更新RodNet算法至最新:add5672731* 注释调试用的代码
36 lines
1.4 KiB
C#
36 lines
1.4 KiB
C#
using BetterGenshinImpact.Core.Config;
|
|
using BetterGenshinImpact.Core.Recognition.OCR;
|
|
using BetterGenshinImpact.Core.Recognition.ONNX;
|
|
using BetterGenshinImpact.UnitTest.CoreTests.RecognitionTests.OCRTests;
|
|
|
|
namespace BetterGenshinImpact.UnitTest.GameTaskTests.AutoFishingTests
|
|
{
|
|
[Collection("Init Collection")]
|
|
public partial class BehavioursTests
|
|
{
|
|
#pragma warning disable CS8618 // 在退出构造函数时,不可为 null 的字段必须包含非 null 值。请考虑添加 "required" 修饰符或声明为可为 null。
|
|
private static BgiYoloPredictor predictor;
|
|
#pragma warning restore CS8618 // 在退出构造函数时,不可为 null 的字段必须包含非 null 值。请考虑添加 "required" 修饰符或声明为可为 null。
|
|
|
|
private readonly PaddleFixture paddle;
|
|
|
|
public BehavioursTests(PaddleFixture paddle, TorchFixture torch)
|
|
{
|
|
this.paddle = paddle;
|
|
this.useTorch = torch.UseTorch;
|
|
}
|
|
|
|
private IOcrService OcrService => paddle.Get();
|
|
|
|
private static BgiYoloPredictor Predictor
|
|
{
|
|
get
|
|
{
|
|
return LazyInitializer.EnsureInitialized(ref predictor, () => new BgiOnnxFactory(new HardwareAccelerationConfig(), new FakeLogger<BgiOnnxFactory>()).CreateYoloPredictor(BgiOnnxModel.BgiFish));
|
|
}
|
|
}
|
|
|
|
private readonly bool useTorch;
|
|
}
|
|
}
|