All Projects → cbovar → Convnetsharp

cbovar / Convnetsharp

Licence: mit
Deep Learning in C#

Programming Languages

csharp
926 projects

Projects that are alternatives of or similar to Convnetsharp

Intelligo
🤖 Chatbot Framework for Node.js.
Stars: ✭ 347 (-11.03%)
Mutual labels:  ai
Torch2coreml
Torch7 -> CoreML
Stars: ✭ 363 (-6.92%)
Mutual labels:  ai
W.i.l.l
A python written personal assistant
Stars: ✭ 377 (-3.33%)
Mutual labels:  ai
Vespa
The open big data serving engine. https://vespa.ai
Stars: ✭ 3,747 (+860.77%)
Mutual labels:  ai
Interpret
Fit interpretable models. Explain blackbox machine learning.
Stars: ✭ 4,352 (+1015.9%)
Mutual labels:  ai
Cs Wiki
🎉 致力打造完善的 Java 后端知识体系,不仅仅帮助各位小伙伴快速且系统的准备面试,更指引学习的方向
Stars: ✭ 369 (-5.38%)
Mutual labels:  ai
Autoscraper
A Smart, Automatic, Fast and Lightweight Web Scraper for Python
Stars: ✭ 4,077 (+945.38%)
Mutual labels:  ai
Sota Py
A discrete-time Python-based solver for the Stochastic On-Time Arrival routing problem
Stars: ✭ 381 (-2.31%)
Mutual labels:  convolution
Imaging
Imaging is a simple image processing package for Go
Stars: ✭ 4,023 (+931.54%)
Mutual labels:  convolution
Capsnet Visualization
🎆 A visualization of the CapsNet layers to better understand how it works
Stars: ✭ 371 (-4.87%)
Mutual labels:  ai
Rivescript Js
A RiveScript interpreter for JavaScript. RiveScript is a scripting language for chatterbots.
Stars: ✭ 350 (-10.26%)
Mutual labels:  ai
Machinelearning Deeplearning Nlp Leetcode Statisticallearningmethod Tensorflow
最近在学习机器学习,深度学习,自然语言处理,统计学习方法等知识,理论学习主要根据readme的链接,在学习理论的同时,决定自己将学习的相关算法用Python实现一遍,并结合GitHub上相关大牛的代码进行改进,本项目会不断的更新相关算法,欢迎star,fork和关注。 主要包括: 1.吴恩达Andrew Ng老师的机器学习课程作业个人笔记 Python实现, 2.deeplearning.ai(吴恩达老师的深度学习课程笔记及资源) Python实现, 3.李航《统计学习方法》 Python代码实现, 4.自然语言处理NLP 牛津大学xDeepMind Python代码实现, 5.LeetCode刷题,题析,分析心得笔记 Java和Python代码实现, 6.TensorFlow人工智能实践代码笔记 北京大学曹健老师课程和TensorFlow:实战Google深度学习框架(第二版) Python代码实现, 附带一些个人心得和笔记。GitHub上有很多机器学习课程的代码资源,我也准备自己实现一下,后续会更新笔记,代码和百度云网盘链接。 这个项目主要是学习算法的,并且会不断更新相关资源和代码,欢迎关注,star,fork! Min's blog 欢迎访问我的博客主页! (Welcome to my blog website !)https://liweimin1996.github.io/
Stars: ✭ 359 (-7.95%)
Mutual labels:  ai
Differentiable Plasticity
Implementations of the algorithms described in Differentiable plasticity: training plastic networks with gradient descent, a research paper from Uber AI Labs.
Stars: ✭ 371 (-4.87%)
Mutual labels:  ai
Devops Roadmap
DevOps methodology & roadmap for a devops developer in 2019. Interesting books to learn new technologies.
Stars: ✭ 349 (-10.51%)
Mutual labels:  ai
Movement Tracking
UP - DOWN - LEFT - RIGHT movement tracking.
Stars: ✭ 379 (-2.82%)
Mutual labels:  ai
Csinva.github.io
Slides, paper notes, class notes, blog posts, and research on ML 📉, statistics 📊, and AI 🤖.
Stars: ✭ 342 (-12.31%)
Mutual labels:  ai
Max Image Resolution Enhancer
Upscale an image by a factor of 4, while generating photo-realistic details.
Stars: ✭ 361 (-7.44%)
Mutual labels:  ai
Sourcery
Refactor Python using AI. ⭐ this repo and Sourcery Starbot will send you a PR
Stars: ✭ 372 (-4.62%)
Mutual labels:  ai
Bigdl
Building Large-Scale AI Applications for Distributed Big Data
Stars: ✭ 3,813 (+877.69%)
Mutual labels:  ai
The Math Of Intelligence
List of resources & possible pathway for the Math of Machine Learning and AI.
Stars: ✭ 370 (-5.13%)
Mutual labels:  ai



Build status ConvNetSharp NuGet package ConvNetSharp NuGet package

ConvNetSharp

Started initially as C# port of ConvNetJS. You can use ConvNetSharp to train and evaluate convolutional neural networks (CNN).

Thank you very much to the original author of ConvNetJS (Andrej Karpathy) and to all the contributors!
ConvNetSharp relies on ManagedCuda library to acces NVidia's CUDA

3 ways to create neural network

Core.Layers Flow.Layers Computation graph
No computation graph Layers that create a computation graph behind the scene 'Pure flow'
Network organised by stacking layers Network organised by stacking layers 'Ops' connected to each others. Can implement more complex networks
Layers Layers Layers
E.g. MnistDemo E.g. MnistFlowGPUDemo or Flow version of Classify2DDemo E.g. ExampleCpuSingle

Example Code

Here's a minimum example of defining a 2-layer neural network and training it on a single data point:

using System;
using ConvNetSharp.Core;
using ConvNetSharp.Core.Layers.Double;
using ConvNetSharp.Core.Training.Double;
using ConvNetSharp.Volume;
using ConvNetSharp.Volume.Double;

namespace MinimalExample
{
    internal class Program
    {
        private static void Main()
        {
            // specifies a 2-layer neural network with one hidden layer of 20 neurons
            var net = new Net<double>();

            // input layer declares size of input. here: 2-D data
            // ConvNetJS works on 3-Dimensional volumes (width, height, depth), but if you're not dealing with images
            // then the first two dimensions (width, height) will always be kept at size 1
            net.AddLayer(new InputLayer(1, 1, 2));

            // declare 20 neurons
            net.AddLayer(new FullyConnLayer(20));

            // declare a ReLU (rectified linear unit non-linearity)
            net.AddLayer(new ReluLayer());

            // declare a fully connected layer that will be used by the softmax layer
            net.AddLayer(new FullyConnLayer(10));

            // declare the linear classifier on top of the previous hidden layer
            net.AddLayer(new SoftmaxLayer(10));

            // forward a random data point through the network
            var x =  BuilderInstance.Volume.From(new[] { 0.3, -0.5 }, new Shape(2));

            var prob = net.Forward(x);

            // prob is a Volume. Volumes have a property Weights that stores the raw data, and WeightGradients that stores gradients
            Console.WriteLine("probability that x is class 0: " + prob.Get(0)); // prints e.g. 0.50101

            var trainer = new SgdTrainer(net) { LearningRate = 0.01, L2Decay = 0.001 };
            trainer.Train(x, BuilderInstance.Volume.From(new[] { 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 }, new Shape(1, 1, 10, 1))); // train the network, specifying that x is class zero

            var prob2 = net.Forward(x);
            Console.WriteLine("probability that x is class 0: " + prob2.Get(0));
            // now prints 0.50374, slightly higher than previous 0.50101: the networks
            // weights have been adjusted by the Trainer to give a higher probability to
            // the class we trained the network with (zero)
        }
    }
}

Fluent API (see FluentMnistDemo)

var net = FluentNet<double>.Create(24, 24, 1)
                   .Conv(5, 5, 8).Stride(1).Pad(2)
                   .Relu()
                   .Pool(2, 2).Stride(2)
                   .Conv(5, 5, 16).Stride(1).Pad(2)
                   .Relu()
                   .Pool(3, 3).Stride(3)
                   .FullyConn(10)
                   .Softmax(10)
                   .Build();

GPU

To switch to GPU mode:

  • add 'GPU' in the namespace: using ConvNetSharp.Volume.GPU.Single; or using ConvNetSharp.Volume.GPU.Double;
  • add BuilderInstance<float>.Volume = new ConvNetSharp.Volume.GPU.Single.VolumeBuilder(); or BuilderInstance<double>.Volume = new ConvNetSharp.Volume.GPU.Double.VolumeBuilder(); at the beggining of your code

You must have CUDA version 10.0 and cuDNN v7.6.4 (September 27, 2019), for CUDA 10.0 installed. cuDNN bin path should be referenced in the PATH environment variable.

Mnist GPU demo here

Save and Load Network

Serialization in ConvNetSharp.Core

using ConvNetSharp.Core.Serialization;

[...]

// Serialize to json 
var json = net.ToJson();

// Deserialize from json
Net deserialized = SerializationExtensions.FromJson<double>(json);

Serialization in ConvNetSharp.Flow

using ConvNetSharp.Flow.Serialization;

[...]

// Serialize to two files: MyNetwork.graphml (graph structure) / MyNetwork.json (volume data)
net.Save("MyNetwork");

// Deserialize from files
var deserialized = SerializationExtensions.Load<double>("MyNetwork", false)[0];  // first element is the network (second element is the cost if it was saved along)
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].