Package: sas-dlpy
DLPy - SAS Viya Deep Learning API for PythonAn efficient way to apply deep learning methods to image, text, and audio data.OverviewDLPy is a high-level Python library for the SAS Deep learning features
available in SAS Viya. DLPy is designed to provide an efficient way to
apply deep learning methods to image, text, and audio data. DLPy APIs
created following theKerasAPIs with a touch
ofPyTorchflavor.What's Recently AddedText, audio, and time series support in addition to imageNew APIs for:RNN based tasks: text classification, text generation, and sequence labelingObject detectionImage segmentationTime series processing and modelingProcessing audio files and creating speech recognition modelsAdditional pre-defined network architectures such as DenseNet, DarkNet, Inception, Yolo,
FasterRCNN, U-Net, MobileNet, and ShuffleNetEnhanced data visualization and metadata handlingPrerequisitesPython version 3 or greater is requiredInstall SASScripting Wrapper for Analytics Transfer (SWAT)for Python usingpip install swatorconda install -c sas-institute swatAccess to a SAS Viya 3.4 environment withVisual Data Mining and Machine Learning(VDMML) is requiredA user login to your SAS Viya back-end is required. See your system administrator for details if you do not have a SAS Viya account.It is recommended that you install the open source graph visualization software calledGraphvizto enable graphic visualizations of the DLPy deep learning modelsInstall DLPy usingpip install sas-dlpyorconda install -c sas-institute sas-dlpySAS Viya and VDMML versions vs. DLPY versionsDLPy versions are aligned with the SAS Viya and VDMML versions.
Below is the versions matrix.DLPySAS ViyaVDMML1.1.x3.48.41.0.x3.48.3The table above can be read as follows: DLPy versions between 1.0 (inclusive)
to 1.1 (exclusive) are designed to work with the SAS Viya 3.4 and VDMML 8.3.External LibrariesThe following versions of external libraries are supported:ONNX: versions >= 1.5.0Keras: versions >= 2.1.3Getting StartedTo connect to a SAS Viya server, import SWAT and use the swat.CAS class to
create a connection:Note: The default CAS port is 5570.>>> import swat
>>> sess = swat.CAS('mycloud.example.com', 5570)Next, import the DLPy package, and then build a simple convolutional
neural network (CNN) model.Import DLPy model functions:>>> from dlpy import Model, Sequential
>>> from dlpy.layers import *Use DLPy to create a sequential model and name itSimple_CNN:>>> model1 = Sequential(sess, model_table = 'Simple_CNN')Define an input layer to add tomodel1:# The input shape contains RGB images (3 channels)
# The model images are 224 px in height and 224 px in width

>>> model1.add(InputLayer(3,224,224))

NOTE: Input layer added.Add a 2D convolution layer and a pooling layer:# Add 2-Dimensional Convolution Layer to model1
# that has 8 filters and a kernel size of 7. 

>>> model1.add(Conv2d(8,7))

NOTE: Convolutional layer added.

# Add Pooling Layer of size 2

>>> model1.add(Pooling(2))

NOTE: Pooling layer added.Add an additional pair of 2D convolution and pooling layers:# Add another 2D convolution Layer that has 8 filters and a kernel size of 7 

>>> model1.add(Conv2d(8,7))

NOTE: Convolutional layer added.

# Add a pooling layer of size 2 to # complete the second pair of layers. 

>>> model1.add(Pooling(2))

NOTE: Pooling layer added.Add a fully connected layer:# Add Fully-Connected Layer with 16 units

>>> model1.add(Dense(16))

NOTE: Fully-connected layer added.Finally, add the output layer:# Add an output layer that has 2 nodes and uses
# the Softmax activation function 

>>> model1.add(OutputLayer(act='softmax',n=2))

NOTE: Output layer added.
NOTE: Model compiled successfullyAdditional ResourcesDLPy examples:https://github.com/sassoftware/python-dlpy/tree/master/examplesDLPy API documentationsassoftware.github.io/python-dlpy.SAS SWAT for PythonSAS ESPPyWatch: DLPy videos:DLPy v1.0 examples:Image classification using CNNsObject detection using TinyYOLOv2Import and export deep learning models with ONNXText classification and text generation using RNNsTime series forecasting using RNNsDLPy v1.1 examples:Leverage Functional APIs to Build Complex ModelsImage Segmentation with U-NetObject Detection with Faster-RCNNImage Classification with ShuffleNet and MobileNetMulti-class Deep learningSAS Deep Learning with Python made easy using DLPyContributingHave something cool to share? SAS gladly accepts pull requests on GitHub! See theContributor Agreementfor details.LicensingLicensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License.
You may obtain a copy of the License atLICENSE.txtUnless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.