## 3 Proposed Methods  
This section presents a comprehensive methodology for the proposed approach while highlighting its key components. Our model, as shown in Figure 1, utilizing the ResNet50 model as its foundation, requires input as a 3D tensor with a size of 224 \(\times\) 224 \(\times\) 3 for color images to be introduced to the model for training and classification, and has been pre-trained on ImageNet to leverage its weights. We use the GRU, LSTM, and Transformer models to evaluate this model. Building upon ResNet50 CNN as a solid base with pre-trained weights, we incorporate transfer learning techniques by incorporating three fully connected layers. We then train our model on the labeled cloth videos dataset to achieve optimal performance. Figure 1: A CNN-Transformer model is proposed for training and evaluation, as depicted in the block diagram. It involves splitting an image into fixed-size patches, linearly embedding each patch, adding position embeddings, and then feeding the resulting sequence of vectors to a standard transformer encoder. To enable classification, the standard approach of including an additional learnable “classification token” in the sequence is used. The process flow of our video classification model, as presented in Figure 2, starts with importing the necessary libraries and initializing hyperparameters. We use Python's TensorFlow and Keras libraries in building and training the model. Hyperparameters (e.g., batch size, learning rate, and the number of epochs) are set at this stage to control the training process. Next, we proceed with loading and preprocessing the video frames for feature extraction. The video frames are normalized to ensure consistent intensity levels across different videos. Moreover, to focus on the most relevant information, we crop the center of each video frame using the **\"Cropping_frame0\"** function. Next, we introduce the feature extraction step, where a pre-trained ResNet50 model is utilized. This ResNet50 model acts as a feature extractor, transforming each video frame into a compact representation that captures essential visual information. The **\"Feature_extractor\"** function is responsible for extracting features, and the resulting model is saved as a NumPy file for later use. With the feature extraction process completed, we move on to defining the main model, which incorporates the Transformer architecture. Our Transformer-based model consists of two custom layers: **\"PositionalEmbedding0\"** and **\"TransformerEncoder0\"**. The **\"PositionalEmbedding0\"** layer plays an important role in adding positional information to the input sequence, which is essential for the Transformer model to understand the temporal ordering of video frames. By including positional embeddings, our model gains temporal awareness, which allows it to achieve better video classification performance. The core of the Transformer model is in the **\"TransformerEncoder0\"** layer, which performs self-attention and feedforward transformations. Self-attention allows the model to attend to different parts of the input sequence when making predictions, thereby allowing it to focus on the most relevant frames at different time steps. The feedforward transformation helps capture complex relationships and patterns between video frames. The **\"TransformerEncoder()\"** layer is highly customizable and includes several hyper-parameters: (1) **MAX_SEQ_LENGTH**: controls the maximum number of frames that the  
Figure 2: Process Flow of Video Classification model using Transformer model. Transformer can process in a single video sequence. Sequences longer than this length will be truncated or padded to fit this limit. (2) **embed_dim**: determines the dimension of the embedded feature representations output by the self-attention mechanism. (3) **dense_dim**: controls the number of units in the intermediate dense layer, providing flexibility in the model's capacity. (4) **num_heads**: indicates the number of attention heads used in the multi-head attention mechanism.