Home

Awesome


Deprecated

Please see the ANTsRNet repo.


ANTsRNetExamples

A collection of examples and models for the ANTsRNet package.


Misc topics

To do:



My GPU set-up

Hardware

Software

Set-up

(see note in Misc. about when to plug in/turn on eGPU)

  1. Put together Titan XP and Aikito node
  2. Install web drivers and GPU support
  3. Install NVIDIA toolkit and cuDNN
  4. Re-install web drivers and GPU support
  5. Install tensorflow-gpu
  6. Install keras with tensorflow-gpu

Update (April 11, 2018): The recent MacOSx update (10.13.4) broke the eGPU compatiblity as explained here.

Misc. notes



My laptop set-up

Hardware

Software

Misc. notes

$ R

R version 3.5.1 (2018-07-02) -- "Feather Spray"
Copyright (C) 2018 The R Foundation for Statistical Computing
Platform: x86_64-apple-darwin15.6.0 (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

  Natural language support but running in an English locale

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.


*** Successfully loaded .Rprofile ***

##------ [/Users/ntustison/Pkg] Thu Oct 25 20:56:11 2018 ------##
> library( keras )
Using plaidml.keras.backend backend.
> use_backend(backend = "plaidml")
> K <- backend()
> K$backend()
[1] "plaidml.keras.backend"
> batch_size <- 128
> num_classes <- 10
> epochs <- 5
> img_rows <- 28
> img_cols <- 28
> 
> 
> mnist <- dataset_mnist()
x_train <- mnist$train$x
y_train <- mnist$train$y
x_test <- mnist$test$x
y_test <- mnist$test$y
> x_train <- mnist$train$x
> y_train <- mnist$train$y
> x_test <- mnist$test$x
> y_test <- mnist$test$y
> x_train <- array_reshape(x_train, c(nrow(x_train), img_rows, img_cols, 1))
> x_test <- array_reshape(x_test, c(nrow(x_test), img_rows, img_cols, 1))
> input_shape <- c(img_rows, img_cols, 1)
> 
> x_train <- x_train / 255
> x_test <- x_test / 255
> 
> y_train <- to_categorical(y_train, 10)
> y_test <- to_categorical(y_test, 10)
> 
> model <- keras_model_sequential() %>%
+   layer_conv_2d(filters = 32, kernel_size = c(3,3), activation = 'relu',
+                 input_shape = input_shape) %>% 
+   layer_conv_2d(filters = 64, kernel_size = c(3,3), activation = 'relu') %>% 
+   layer_max_pooling_2d(pool_size = c(2, 2)) %>% 
+   layer_dropout(rate = 0.25) %>% 
+   layer_flatten() %>% 
+   layer_dense(units = 128, activation = 'relu') %>% 
+   layer_dropout(rate = 0.5) %>% 
+   layer_dense(units = num_classes, activation = 'softmax')
INFO:plaidml:Opening device "metal_amd_radeon_pro_580.0"
> 
> summary(model)
________________________________________________________________________________
Layer (type)                        Output Shape                    Param #     
================================================================================
conv2d_1 (Conv2D)                   (None, 26, 26, 32)              320         
________________________________________________________________________________
conv2d_2 (Conv2D)                   (None, 24, 24, 64)              18496       
________________________________________________________________________________
max_pooling2d_1 (MaxPooling2D)      (None, 12, 12, 64)              0           
________________________________________________________________________________
dropout_1 (Dropout)                 (None, 12, 12, 64)              0           
________________________________________________________________________________
flatten_1 (Flatten)                 (None, 9216)                    0           
________________________________________________________________________________
dense_1 (Dense)                     (None, 128)                     1179776     
________________________________________________________________________________
dropout_2 (Dropout)                 (None, 128)                     0           
________________________________________________________________________________
dense_2 (Dense)                     (None, 10)                      1290        
================================================================================
Total params: 1,199,882
Trainable params: 1,199,882
Non-trainable params: 0
________________________________________________________________________________
> 
> model %>% compile(
+   loss = loss_categorical_crossentropy,
+   optimizer = optimizer_adadelta(),
+   metrics = c('accuracy')
+ )
> model %>% fit(
+   x_train, y_train,
+   batch_size = batch_size,
+   epochs = epochs,
+   validation_split = 0.2
+ )
Train on 48000 samples, validate on 12000 samples
Epoch 1/5
INFO:plaidml:Analyzing Ops: 85 of 285 operations complete
48000/48000 [==============================] - 18s 372us/step - loss: 0.3130 - acc: 0.9042 - val_loss: 0.0702 - val_acc: 0.9803
Epoch 2/5
48000/48000 [==============================] - 10s 200us/step - loss: 0.0982 - acc: 0.9705 - val_loss: 0.0543 - val_acc: 0.9846
Epoch 3/5
48000/48000 [==============================] - 9s 188us/step - loss: 0.0721 - acc: 0.9787 - val_loss: 0.0490 - val_acc: 0.9867
Epoch 4/5
48000/48000 [==============================] - 9s 188us/step - loss: 0.0613 - acc: 0.9814 - val_loss: 0.0410 - val_acc: 0.9882
Epoch 5/5
48000/48000 [==============================] - 9s 187us/step - loss: 0.0510 - acc: 0.9851 - val_loss: 0.0418 - val_acc: 0.9882