mirror of
https://github.com/babalae/better-genshin-impact.git
synced 2026-03-20 08:29:50 +08:00
* 使用TorchSharp重写RodNet,以利后续优化 * 增加一个外部torch加载配置来代替直接的依赖,如配置不生效则使用原先手搓的算法 * BgiOnnxFactory取消单例,改为在App服务类中注册为单例,由此修复了一堆单元测试 * BgiOnnxFactory中几个静态方法改为成员方法以和App解耦;因不再有多个mat源供消耗,FishBite中文字块算法不再改动传入的mat,使得后续串联的算法不受其影响 * 将BehavioursTests中临时的配置读取方式改为读取主项目编译环境中的json文件;新建单元测试的README * 将RodNet算法更新到010006a44c的版本;RodNet中关于torch库推理和直接数学计算的校验移至单元测试 * 更新RodNet算法至最新:add5672731* 注释调试用的代码
33 lines
1.1 KiB
C#
33 lines
1.1 KiB
C#
using System;
|
|
using System.Diagnostics;
|
|
using System.Linq;
|
|
using BetterGenshinImpact.Core.Config;
|
|
using BetterGenshinImpact.Core.Recognition.ONNX;
|
|
using BetterGenshinImpact.GameTask;
|
|
using CommunityToolkit.Mvvm.Input;
|
|
|
|
namespace BetterGenshinImpact.ViewModel.Pages.View;
|
|
|
|
using CommunityToolkit.Mvvm.ComponentModel;
|
|
using Microsoft.Extensions.DependencyInjection;
|
|
|
|
public partial class HardwareAccelerationViewModel : ObservableObject, IViewModel
|
|
{
|
|
public HardwareAccelerationConfig Config { get; set; }
|
|
public BgiOnnxFactory Status { get; set; }
|
|
[ObservableProperty]
|
|
private InferenceDeviceType[] _inferenceDeviceTypes = Enum.GetValues<InferenceDeviceType>();
|
|
[ObservableProperty]
|
|
private string _providerTypesText;
|
|
public HardwareAccelerationViewModel()
|
|
{
|
|
Config = TaskContext.Instance().Config.HardwareAccelerationConfig;
|
|
Status = App.ServiceProvider.GetRequiredService<BgiOnnxFactory>();
|
|
_providerTypesText = string.Join(",", Status.ProviderTypes);
|
|
}
|
|
[RelayCommand]
|
|
public void OnOpenCacheFolder()
|
|
{
|
|
Process.Start("explorer.exe", Global.Absolute(BgiOnnxModel.ModelCacheRelativePath));
|
|
}
|
|
} |