Skip to content

Quadrollopo/Alexnet_Cuda

Repository files navigation

Alexnet in Cuda

While the goal was to implement alexnet in cuda, you can create all the architecture you want, using convolutional, maxpool and fully connected layer.
Here there is an exemple of a network with 2 conv layers and 3 FC layers.

Creating a network

You can create a network by calling:
Network net(num_neurons, lr) if you want create a network with only FC
or
Network net(img_side, channels, lr) if you want create a network with the first layer convolutional
Where

  • num_neurons is the number of neurons of the first layer
  • img_side is the side of the input image, so if you want to import an image 24x24 put 24 here. You can only work on squared images
  • channels the channels of the input image, in a nutshell, 1 if the image is black and white and 3 if is colored
  • lr the learning rate

You can then add new layer by calling the proper function to the network

  • net.addConvLayer(int kern_size, int num_kernels, int stride, bool pad, Act func) if pad is true will pad the image with kern_size-1, and func is the activation function choose between reLu, sigmoid and softmax
  • net.addFullLayer(int neurons, Act func) where neurons is the number of neuron of the layer
  • net.addPoolLayer(int pool_size, int stride) where pool_size is the size of the max pooling kernel, also this is a square

About

A cuda implementation of Alexnet

Resources

Stars

Watchers

Forks

Contributors 3

  •  
  •  
  •  

Languages