Available models
Functions for creating the models (mm_cesnet_v1
and mm_cesnet_v2
) share the following behavior. When the weights
parameter is specified, the pre-trained weights will be downloaded and cached in the model_dir
folder. The returned model will be in the evaluation mode.
On the other hand, when the weights
parameter is not specified, the model will be initialized with random weights (default PyTorch behavior), and the following arguments become mandatory:
num_classes
- the number of classes, which defines the output size of the last linear layer.flowstats_input_size
- the number of flow statistics features and, therefore, the input size of the first linear layer processing them.ppi_input_channels
- the number of channels in PPI sequences. The standard value is three for packet sizes, directions, and inter-arrival times.
Input
The models expect input in the format of tuple(batch_ppi, batch_flowstats)
. The shapes are:
- batch_ppi
torch.tensor (B, ppi_input_channels, 30)
- batch size ofB
and the length of PPI sequences is required to be 30. - batch_flowstats
torch.tensor (B, flowstats_input_size)
All Jupyter notebooks listed on the getting started page show how to feed data into the models.
models.mm_cesnet_v2
mm_cesnet_v2(
weights=None,
model_dir=None,
num_classes=None,
flowstats_input_size=None,
ppi_input_channels=None,
)
This is a second version of the multimodal CESNET architecture. It was used in the "Encrypted traffic classification: the QUIC case" paper.
Changes from the first version
- Global pooling was added to the CNN part processing PPI sequences, instead of a simple flattening.
- One more Conv1D layer was added to the CNN part and the number of channels was increased.
- The size of the MLP processing flow statistics was increased.
- The size of the MLP processing shared representations was decreased.
- Some dropout rates were decreased.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
weights |
Optional[MM_CESNET_V2_Weights]
|
If provided, the model will be initialized with these weights. |
None
|
model_dir |
Optional[str]
|
If weights are provided, this folder will be used to store the weights. |
None
|
num_classes |
Optional[int]
|
Number of classes. |
None
|
flowstats_input_size |
Optional[int]
|
Size of the flow statistics input. |
None
|
ppi_input_channels |
Optional[int]
|
Number of channels in the PPI input. |
None
|
Source code in cesnet_models\models.py
90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 |
|
models.mm_cesnet_v1
mm_cesnet_v1(
weights=None,
model_dir=None,
num_classes=None,
flowstats_input_size=None,
ppi_input_channels=None,
)
This model was used in the "Fine-grained TLS services classification with reject option" paper.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
weights |
Optional[MM_CESNET_V1_Weights]
|
If provided, the model will be initialized with these weights. |
None
|
model_dir |
Optional[str]
|
If weights are provided, this folder will be used to store the weights. |
None
|
num_classes |
Optional[int]
|
Number of classes. |
None
|
flowstats_input_size |
Optional[int]
|
Size of the flow statistics input. |
None
|
ppi_input_channels |
Optional[int]
|
Number of channels in the PPI input. |
None
|
Source code in cesnet_models\models.py
182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 |
|