In [8]:
import os
import json
import requests
import numpy as np
np.set_printoptions(threshold=np.nan)
import cv2

Using Shared Folder

You can specify a directory on the host computer that can be accessed within your script. This is good when:

  • Your script needs to load data from local files, such as csv files or a directory of text or image files, as training or test data.
  • Your script processes raw data, and writes out intermediate results, such as featurized training data from text/image files, that are used in a subsequent training run.
  • Your script spits out a model, and your subsequent scoring script needs to pick up the model and use it for evaluation.

To enable this feature, you'll need to specify the following in each of your {target}.compute file:

  • sharedVolumes: true
  • nativeSharedDirectory: "/any_directory/on/the/host/computer/"

In [11]:
# this folder maps to the nativeSharedDirectory variable specified 
# in the {target}.compute aml_config file
base_directory = os.environ['AZUREML_NATIVE_SHARE_DIRECTORY']
os.chdir(base_directory)
os.getcwd()


Out[11]:
'C:\\tmp\\VuLeAMLExperimentation\\VuLeAMLExpWorkspace\\aml-deep-learning-mnist'

In [12]:
%ls


 Volume in drive C is OSDisk
 Volume Serial Number is 58ED-863C

 Directory of C:\tmp\VuLeAMLExperimentation\VuLeAMLExpWorkspace\aml-deep-learning-mnist

10/14/2017  11:03 PM    <DIR>          .
10/14/2017  11:03 PM    <DIR>          ..
10/03/2017  05:27 PM    <DIR>          mnist_png
               0 File(s)              0 bytes
               3 Dir(s)  206,457,700,352 bytes free

In [23]:
path_to_image = base_directory + "mnist_png/testing/7/0.png"
img_width, img_height = 28, 28

In [24]:
img = cv2.imread(path_to_image)
#img = cv2.resize(img, (img_width, img_height)

In [25]:
path_to_image


Out[25]:
'/tmp//VuLeAMLExperimentation/VuLeAMLExpWorkspace/aml-deep-learning-mnist/mnist_png/testing/7/0.png'

In [ ]: