lichen11 commented on issue #7968: [R] Transfer Learning using VGG-16
URL: 
https://github.com/apache/incubator-mxnet/issues/7968#issuecomment-355379685
 
 
   Hi, I recently attempted transfer learning on ResNet101. I only retrain the 
last fully connected layer. 
   
       resnet101<- mx.model.load("Model/ResNet/resnet-101", iteration=0)
       symbol<- resnet101$symbol
       internals<- symbol$get.internals()
       outputs<- internals$outputs
       flatten<- internals$get.output(which(outputs=="flatten0_output"))
       new_fc<- mx.symbol.FullyConnected(data=flatten, num_hidden=2, 
name="fc1") 
       new_soft <- mx.symbol.SoftmaxOutput(data=new_fc, name='softmax')
       arg_params_new<- mxnet:::mx.model.init.params(
           symbol = new_soft, 
           input.shape = list(data = c(224,224,3,32)), 
           output.shape = NULL,
           initializer = mxnet:::mx.init.uniform(0.1), 
           ctx =mx.gpu(0) 
           )$arg.params
   
       fc1_weights_new<- arg_params_new[["fc1_weight"]]
       fc1_bias_new<- arg_params_new[["fc1_bias"]]
       arg_params_new <- resnet101$arg.params
       arg_params_new[["fc1_weight"]] <- fc1_weights_new 
       arg_params_new[["fc1_bias"]] <- fc1_bias_new 
   
   However, when I initiate training, my R would crash. It first gives the 
following msg:
   
       Start training with 1 devices
       [19:35:16] src/operator/nn/./cudnn/./cudnn_algoreg-inl.h:107: Running 
performance tests to find the         best convolution algorithm, this can take 
a while... (setting env variable MXNET_CUDNN_AUTOTUNE_DEFAULT to 0 to disable)
   
   Then it crashes. I searched online to set MXNET_CUDNN_AUTOTUNE to 0 to 
disable and updated my mxnet to 1.0.0., since some say this version will 
resolve the MXNET_CUDNN_AUTOTUNE issue. However, after updating, my R is still 
crashing when using ResNet or VGG. Meanwhile, transfer learning using Inception 
does not crash. I am wondering if there is an internal bug in mxnet R to cause 
this issue. 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to