用卷积滤波器matlab代码-tnn-train:训练三元神经网络

  • Y9_987556
    了解作者
  • 95.7KB
    文件大小
  • zip
    文件格式
  • 0
    收藏次数
  • VIP专享
    资源类型
  • 0
    下载次数
  • 2022-04-25 07:30
    上传日期
用卷积滤波器matlab代码该存储库已发布,用于在以下出版物中复制结果 Hande Alemdar,Vincent Leroy,Adrien Prost-Boucle和Frederic Petrot。 “用于资源高效的AI应用程序的三元神经网络”。 在:国际神经网络联合会议(IJCNN)。 2017。 该存储库提供了学生网络的培训代码。 以下存储库中提供了分层代码。 安装 要求 需要以下python软件包: git clone https://github.com/caldweln/distro.git ~/torch --recursive cd ~/torch;TORCH_LUA_VERSION=LUA51 ./install.sh;source install/bin/torch-activate; git clone https://github.com/caldweln/dp.git ~/dp cd ~/dp; luarocks make rocks/dp-scm-1.rockspec git clone https://github.com/caldweln/nninit.
tnn-train-master.zip
内容介绍
This repository is released for reproducing the results in the following publication Hande Alemdar, Vincent Leroy, Adrien Prost-Boucle, and Frederic Petrot. “Ternary Neural Networks for Resource- Efficient AI Applications”. In: International Joint Conference on Neural Networks (IJCNN). 2017. This repository provides the training code of the student network. The ternarization code is provided in the following repository. https://github.com/slide-lig/tnn_convert Installation ============ Requirements ------------ The following python packages are required: ``` git clone https://github.com/caldweln/distro.git ~/torch --recursive cd ~/torch;TORCH_LUA_VERSION=LUA51 ./install.sh;source install/bin/torch-activate; git clone https://github.com/caldweln/dp.git ~/dp cd ~/dp; luarocks make rocks/dp-scm-1.rockspec git clone https://github.com/caldweln/nninit.git ~/nninit cd ~/nninit; luarocks make rocks/nninit-scm-1.rockspec luarocks install dkjson ``` - Optional - CUDA ``` luarocks install cunnx ``` - cuDNN (https://developer.nvidia.com/cudnn) (ensure libcudnn.so.5 location in $LD_LIBRARY_PATH) - CUDA Driver/Toolkit (ensure nvcc location in $PATH) - Other ``` luarocks install matio luarocks install cephes luarocks install csvigo ``` Usage ====== train.lua -------- Use for training and testing the suite of neural network implementations. Navigate to lsr/bin and execute: ``` ~$ th train.lua <files> ``` <files> a variable length .conf file list providing architecture, input and run configuration. Configurations may be a list of part and/or full configurations. If giving a configuration in parts, the combined set must add up to a full configuration. A full configuration consists of 'arch', 'input' and 'run' tables. A composite configuration contains key-values that may cause the configuration to split into two or more separate configuration. Examples of such key-values are detailed below 'Configuration options'. An additional 'main' configuration table may be provided to resume an execution. Example configurations can be found in the /etc directory. Example configuration in full execution: ``` ~$ th train.lua ~/tnn_train/etc/full/simple-mlp.conf ``` Example configuration in parts execution: ``` ~$ th train.lua ~/tnn_train/etc/arch/mlp-1x100.conf ~/tnn_train/etc/input/MNIST.conf ~/tnn_train/etc/run/100_epochs_10_batch.conf ``` Example resuming existing training: ``` ~$ th train.lua ~/tnn_train/log/MLP/results/main.conf ``` Configuration options --------------------- ``` # # arch # arch.modelArch=MLP # MLP | LENET | ProgressiveBinarization | BinaryConnect arch.neuronPerLayerCount.1=1000 # number of neurons for hidden layer 1 arch.neuronPerLayerCount.2=1000 # similarly for hidden layer 2, add/remove layers as desired arch.dropout_in=0 # Probability of an input unit being DROPPED arch.dropout_conv=0 # Probability of an convolutional unit being DROPPED arch.dropout_hidden=0 # Probability of a hidden unit being DROPPED arch.batchnorm.epsilon=0.0001 # BinaryConnect, BatchNormalization argument arch.convChannelSize.1=6 # Filter/Channel size for output of first convolutional layer arch.convChannelSize.2=16 # Filter/Channel size for output of second convolutional layer arch.convKernelSize=5 # Kernel/Receptor size for convolutional layer arch.convPoolSize=2 # Pooling window size for MaxPooling layer arch.convPadding=2 # Padding size for convolutional layer arch.activationFn=ReLU # Activation/non-linearity function to be applied arch.stochFireDuringTraining=1 # Enable/Disable stochastic firing through training arch.criterion=ClassNLLCriterion # SqrHingeEmbeddingCriterion + more at https://github.com/torch/nn/blob/master/doc/criterion.md arch.criterionArg= # rarely used criterion arguments, e.g. 2 for square margin loss with MarginCriterion arch.paramInit.x=weight # weight | bias | weight,bias arch.paramInit.fn=uniform # initialization fn, full list at https://github.com/Kaixhin/nninit arch.paramInit.args.1=-1 # arguments list/table for paramInit.fn arch.paramInit.args.2=1 # arguments list/table for paramInit.fn # # arch prep # A 'perparation' model that precedes the main model defined above # arch.prep.modelArch=PREPCONV # architecture to load just as above, loads a model from the Models dir arch.prep.convChannelSize.1=3 # arch.prep table options for those specific to this preparation model configuration arch.prep.convKernelSize=3 arch.prep.convPadding=1 arch.prep.batchNorm=1 arch.prep.stcFlag=1 arch.prep.outputTernary=1 # # input # input.narize.bitCount=1 # quantize input data to this number of bits input.narize.signed=0 # quantize as 2s complement when this is enabled (=1) input.fractureData=1 # fracture off to use only part of the data: 1 | 0.1 | etc input.distort.count=0 # Number of additional train sets input.distort.rotate=0 # Rotate train data within +/- <rotate> [°] input.distort.scale=0 # Scaled train data within +/- <scale> [%] input.distort.translate=0 # Translate train data within +/- <translate> [px] input.dataset=mnist # input datasource, mnist | notmnist | cifar10 | cifar100 | gtsrb32 | gtsrb48 input.validRatio=0.1 # ratio to split train/valid set, will use dataset default if empty input.normalize=0 # normalize input data input.scale=0 # scale input data input.zca=1 # Performs Zero Component Analysis Whitening on input input.gcn=1 # Performs Global Contrast Normalization on input input.lecunlcn=0 # Implements the Local Contrast Normalization Layer at page 3 in http://yann.lecun.com/exdb/publis/pdf/jarrett-iccv-09.pdf # # run # run.batchSize=200 # mini-batch size run.randseed=1 run.shuffleIndices=1 # shuffle indices to training data on each epoch run.optim.fn=sgd # optim fn, run.optim.fn & run.optim.conf described at https://github.com/torch/optim/blob/master/doc/index.md run.optim.conf.learningRate=0.1 # learning rate run.optim.conf.learningRateDecay=0.001 # learning rate decay, supports schedule table or string formula for adam, adamax and rmsprop (see example lsr/etc/optim/adam.conf) run.optim.conf.momentum=0 # momentum run.optim.conf.weightDecay=0 # weight decay run.optim.conf.dampening=0 # dampening for momentum run.optim.conf.nesterov=false # enables Nesterov momentum # # main # main.verbose=3 # Level of verbosity for output/logging main.stopEarly=30 # Stop training early if determined to have reached best performance main.threads=16 # torch thread count main.cuda=0 # attempt use of CUDA api for GPU usage main.cudnn=0 # use cuDNN modules for faster but non-deterministic training main.nGPU=1 # specify how many GPUs to use main.debug=0 main.dstDir=results_%main.confhash% # friendly name for output main.binPath= main.epochCount=100 # max number of epcohs to run main.logFileSize=100000000 # max log file size m
评论
    相关推荐