ResNet1d
Description
This API calls the ResNet1d model, which can be used for anomaly detection, classification.
ResNet1d Model Architecture

A ResNet1D model is a one-dimensional version of the popular Residual Network (ResNet) architecture, typically used for time series data or sequence-based tasks. ResNet architectures use residual connections, which are shortcuts that allow the gradient to flow directly through layers, mitigating the problem of vanishing gradients in deep neural networks.
Model Structure:
- Input Layer
- Takes one-dimensional time series data as input.
- The data could be a sequence or a time window of measurements (e.g., sensor readings or financial data).
- Residual Blocks
- These blocks consist of convolutional or fully connected layers followed by a skip connection.
- The output of the residual block is the sum of the input and the processed output from the convolutional layers, facilitating the learning of residual features.
- Skip connections help in passing gradients from deeper layers back to the earlier layers, allowing for more effective training of deep networks.
- Convolutional Layers
- For time series data, the model often uses 1D convolutions to learn temporal features.
- Activation Function
- Typically, a ReLU (Rectified Linear Unit) activation function is used to introduce non-linearity.
- Final Layer:
- A fully connected (dense) layer typically follows the residual blocks to output the final predictions, such as classification or regression tasks.
Advantages of ResNet1D:
- Improved Gradient Flow
- The skip connections help in propagating gradients effectively across deep layers, improving convergence speed and allowing for the training of very deep models.
- Better Performance on Complex Sequences
- ResNet1D can capture both short-term and long-term dependencies in time series data, making it useful for tasks like time series forecasting, classification, and anomaly detection.
- Efficient Training
- The residual connections help in overcoming the vanishing gradient problem, which is common in deep neural networks.
API module path
from api.v2.model.ResNet1d import ResidualBlock, ResNet1D
Parameters
block
- Specifies the block.
- This uses the residual block called along with the model.
- Example
- block = ResidualBlock
layers
- Specify the number of residual blocks for each of the 4 layers and represent them in a list format.
- Example
- layers = [2,2,2,2]
num_classes
- Specify the number of classes to be classified.
- Example
- num_classes = 4
Example Sample Code (Python)
Results
- Due to the large size of the result image, only a portion is attached.

Check the entire module code.
datahub/api/v2/model/ResNet1d.py at main · machbase/datahub
All Industrial IoT DataHub with data visualization and AI source - machbase/datahub