环境
.NET Framework 4.6.2 , X64 , VS2022
依赖
OpenCvSharp.dll,OpenCvSharp.Extensions.dll,Microsoft.ML.OnnxRuntime.dll,rvm_resnet50_fp32.onnx
效果

页面

全部逻辑代码
public partial class Form1 : Form
{
private string imgFile = "";
private int process_wd = 360;
private int process_ht = 640;
private InferenceSession session;
private static readonly SimpleObjectPool<List<NamedOnnxValue>> _inputsPool =
new SimpleObjectPool<List<NamedOnnxValue>>(() => new List<NamedOnnxValue>());
private static DenseTensor<float> _emptyTensor;
private static DenseTensor<float> _downsampleRatio;
private static Mat _resizedMat;
private static Mat _normalizedMat;
private static Mat[] _channels;
private static DenseTensor<float> _preprocessTensor;
private static float[] _channelData = new float[0];
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
using (OpenFileDialog ofd = new OpenFileDialog())
{
ofd.Filter = "图像文件|*.jpg;*.png;";
if (ofd.ShowDialog() == DialogResult.OK)
{
imgFile = ofd.FileName;
}
}


1015

被折叠的 条评论
为什么被折叠?



