Skip to content

PhasonMatrix/TorchSharpFlowerClassifier

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 

Repository files navigation

TorchSharpFlowerClassifier

Demo - TorchSharp image classification

This is a port of my CSnakes-based image classifier. This project has no python code, only C#. It uses TorchSharp for training and inference. At first I was hesitant to use TorchSharp as I had previously tried TensorFlow.Net and had a bad experience with bugs and the project was not maintained well. The developer experience with TorchSharp, however, is very good.

In comparison to the CSnakes project, I much prefer using TorchSharp directly in C# than using SCnakes and PyTorch. The code is smaller and cleaner. I get all the benefits of the C# language with no real downside. Everything that can be done in PyTorch can be done in TorchSharp, for this project anyway. I also don't need to a full python environment as part of the app. Inference time in CSnakes/PyTorch was around 150ms, in this project it averages around 50ms - 3x faster! That includes reading the image file and converting to a tensor. In the CSnakes project there was another step of tranfering the image pixel bytes from C# to Python.

TorchSharpFlowerClassifierInference

I added some progress bars for show the progress of the training process. This would have been a pain in CSnakes but was fairly simple using TorchSharp.

TorchSharpFlowerClassifierTraining

About

Demo - TorchSharp image classification

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages