Wolfram Research

ShuffleNet-3D V1 Trained on Video Datasets

Identify the main action in a video

Released in 2019, this family of nets consists of three-dimensional (3D) versions of the original ShuffleNet V1 architecture for video classification. The ShuffleNet V1 architecture utilizes pointwise group convolutions and channel shuffling, two new operations that greatly reduce computational cost while maintaining accuracy. With the availability of large-scale video datasets such as Jester and Kinetics-600, these models achieve much better accuracies compared to their two-dimensional counterparts for video classification task.

Number of models: 8

Training Set Information

Performance

Examples

Resource retrieval

Get the pre-trained net:

In[1]:=
NetModel["ShuffleNet-3D V1 Trained on Video Datasets"]
Out[1]=

NetModel parameters

This model consists of a family of individual nets, each identified by a specific parameter combination. Inspect the available parameters:

In[2]:=
NetModel["ShuffleNet-3D V1 Trained on Video Datasets", "ParametersInformation"]
Out[2]=

Pick a non-default net by specifying the parameters:

In[3]:=
NetModel[{"ShuffleNet-3D V1 Trained on Video Datasets", "Width" -> 1.0, "Dataset" -> "Kinetics"}]
Out[3]=

Pick a non-default uninitialized net:

In[4]:=
NetModel[{"ShuffleNet-3D V1 Trained on Video Datasets", "Width" -> 2.0, "Dataset" -> "Jester"}, "UninitializedEvaluationNet"]
Out[4]=

Basic usage

Identify the main action in a video:

In[5]:=
bbq = ResourceData["Sample Video: Barbecuing"];
In[6]:=
NetModel["ShuffleNet-3D V1 Trained on Video Datasets"][bbq]
Out[6]=

Obtain the probabilities of the 10 most likely entities predicted by the net:

In[7]:=
NetModel["ShuffleNet-3D V1 Trained on Video Datasets"][bbq, {"TopProbabilities", 10}]
Out[7]=

Obtain the list of names of all available classes:

In[8]:=
NetExtract[NetModel["ShuffleNet-3D V1 Trained on Video Datasets"], "Output"][["Labels"]]
Out[8]=

NetModel architecture

ShuffleNet-3D V1 features an efficient and elegant implementation of a channel shuffle operation: a feature map with gn channels is reshaped to expand the channel dimension to two dimensions of sizes (g, n), then transposed and further flattened back as the input of the next layer:

In[9]:=
NetExtract[
 NetModel["ShuffleNet-3D V1 Trained on Video Datasets"], {"block1a", "channel_shuffle"}]
Out[9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p1
Z7qAzkOSXbt2nfeaiRYNa4DMhl9CoGVDUqQkScFgxPbt26drVOMaQLPEkSzK
8JNPPoGfH2Y8IXwbYaDTQcmDH6G+9u/fH+DI6QqjBQOfv7q6ml7p0qVLxK+T
J5ORkZHARTIKUHqbNm0Kf9GD83WB0wEdAQWu23xOnDgBLUV8qGKirsjRRZS2
poXCwsKU4p4WqY/avL/Dwgy2jiwsLCwsLCyiwMDn79u3L73y8ssvR/x6Xl4e
JeW3PtniXMSpU6fatGlDNRtycbjlnhbEa+rXr89T8xFvh7dIOGwdWVhYWFhY
WBhg0qRJ5Dnw6YhhfH5wisGDB1P8Fi1aRJ8u37ZtG28yatas2a233hoxQYu6
xerVq8E6GzduTHV61VVXBcc300OL8xLEaySWLFlS10JZnAVbRxYWFhYWFhYG
4AvKGXF9/t27d7dq1Yoig1wUFxcnRJLc3Fw+5qJBgwYJSdOirjB9+nTWqIyM
jPXr1wfHN9BDi/MVAwcOvOJs+J1KZFFXsHVkYWFhYWFhYYAePXooLoS8P8sT
J0+evOyyy8AO7rzzzpDnOYdERUXFgAEDunbt2qlTpwQma1H7WLJkyU033XTf
ffeNHTtWOdPVEwZ6aGFhYWFhYWFhYWFx3mP27Nlxj4q1sLCwsLCwsLCwsLCw
sLCwsLCwsLCwsLCwsLCwsLCwUPC/q+OIZA==
"], {{0, 17.}, {618., 0}}, {0, 255},
ColorFunction->RGBColor,
ImageResolution->{144., 144.}],
BoxForm`ImageTag["Byte", ColorSpace -> "RGB", Interleaving -> True],
Selectable->False],
DefaultBaseStyle->"ImageGraphics",
ImageSize->Automatic,
ImageSizeRaw->{618., 17.},
PlotRange->{{0, 618.}, {0, 17.}}]\)
Out[10]=

Feature extraction

Remove the last two layers of the trained net so that the net produces a vector representation of an image:

In[11]:=
brushing = ResourceData["Tooth Brushing Video Samples"];
In[12]:=
cheerleading = ResourceData["Cheerleading Video Samples"];
In[13]:=
extractor = NetTake[NetModel[
   "ShuffleNet-3D V1 Trained on Video Datasets"], {1, -4}]
Out[13]=

Get a set of videos:

In[14]:=
videos = Join[brushing, cheerleading];

Visualize the features of a set of videos:

In[15]:=
FeatureSpacePlot[videos, FeatureExtractor -> extractor, LabelingFunction -> (Callout[
     Thumbnail@VideoExtractFrames[#1, Quantity[1, "Frames"]]] &), LabelingSize -> 50, ImageSize -> 600]
Out[15]=

Transfer learning

Use the pre-trained model to build a classifier for telling apart images from two action classes not present in the dataset. Create a test set and a training set:

In[16]:=
videos = <|
   ResourceData["Sample Video: Reading a Book"] -> "reading book", ResourceData["Sample Video: Blowing Glitter"] -> "blowing glitter"|>;
In[17]:=
dataset = Join @@ KeyValueMap[
    Thread[
      VideoSplit[#1, Most@Table[
          Quantity[i, "Frames"], {i, 16, Information[#1, "FrameCount"][[1]], 16}]] -> #2] &,
    videos
    ];
In[18]:=
{train, test} = ResourceFunction["TrainTestSplit"][dataset, "TrainingSetSize" -> 0.7];

Remove the linear layer from the pre-trained net:

In[19]:=
tempNet = NetTake[NetModel[
   "ShuffleNet-3D V1 Trained on Video Datasets"], {1, -3}]
Out[19]=

Create a new net composed of the pre-trained net followed by a linear layer and a softmax layer:

In[20]:=
newNet = NetJoin[tempNet, NetChain[{"Linear" -> LinearLayer[], "Softmax" -> SoftmaxLayer[]}], "Output" -> NetDecoder[{"Class", {"blowing glitter", "reading book"}}]]
Out[20]=

Train on the dataset, freezing all the weights except for those in the "Linear" new layer (use TargetDevice -> "GPU" for training on a GPU):

In[21]:=
trainedNet = NetTrain[newNet, train, LearningRateMultipliers -> {"Linear" -> 1, _ -> 0}, ValidationSet -> Scaled[0.1]]
Out[21]=

Perfect accuracy is obtained on the test set:

In[22]:=
ClassifierMeasurements[trainedNet, test, "Accuracy"]
Out[22]=

Net information

Inspect the number of parameters of all arrays in the net:

In[23]:=
Information[
 NetModel["ShuffleNet-3D V1 Trained on Video Datasets"], "ArraysElementCounts"]
Out[23]=

Obtain the total number of parameters:

In[24]:=
Information[
 NetModel["ShuffleNet-3D V1 Trained on Video Datasets"], "ArraysTotalElementCount"]
Out[24]=

Obtain the layer type counts:

In[25]:=
Information[
 NetModel["ShuffleNet-3D V1 Trained on Video Datasets"], "LayerTypeCounts"]
Out[25]=

Display the summary graphic:

In[26]:=
Information[
 NetModel["ShuffleNet-3D V1 Trained on Video Datasets"], "SummaryGraphic"]
Out[26]=

Export to ONNX

Export the net to the ONNX format:

In[27]:=
onnxFile = Export[FileNameJoin[{$TemporaryDirectory, "net.onnx"}], NetModel["ShuffleNet-3D V1 Trained on Video Datasets"]]
Out[27]=

Get the size of the ONNX file:

In[28]:=
FileByteCount[onnxFile]
Out[28]=

Check some metadata of the ONNX model:

In[29]:=
{opsetVersion, irVersion} = {Import[onnxFile, "OperatorSetVersion"], Import[onnxFile, "IRVersion"]}
Out[29]=

Import the model back into the Wolfram Language. However, the NetEncoder and NetDecoder will be absent because they are not supported by ONNX:

In[30]:=
Import[onnxFile]
Out[30]=

Resource History

Reference