Traffic image and convolutional neural network-based perception service device identification method

By reshaping the entire protocol layer payload of a network session into a two-dimensional grayscale image and utilizing a two-dimensional convolutional neural network, the problems of device category imbalance and background traffic interference in the identification of sensing service devices are solved, achieving high-precision and low-resource device identification results.

CN123145303APending Publication Date: 2026-11-20应急管理部大数据中心
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611512993.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-09-28
Publication Date
2026-11-20

AI Technical Summary

Technical Problem

Existing methods for identifying sensing service devices struggle to achieve robust and data-efficient fine-grained identification when faced with coexisting background traffic, imbalanced device category samples, and cross-environment and cross-dataset challenges. Furthermore, existing solutions lack the ability to resist interference from background traffic.

Method used

By truncating, padding, and reshaping all network protocol layer payloads from the data link layer of a network session into a two-dimensional grayscale image, and using a two-dimensional convolutional neural network for training and recognition, an end-to-end recognition system is constructed. An upper limit on the number of sessions is set and categories with too few samples are eliminated. The model is trained using a progressive approach to interference traffic complexity.

Benefits of technology

It achieves high-precision, low-resource identification of sensing service devices in complex network environments. It can automatically learn the differences between device protocol stacks and firmware implementations, and has strong robustness and high data efficiency, adapting to dynamic environments where devices are frequently added or removed.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN123145303A_ABST
    Figure CN123145303A_ABST
Patent Text Reader

Abstract

The application discloses a perception service device identification method based on traffic images and a convolutional neural network. During training, historical traffic is divided according to bidirectional communication sessions, and all protocol layer loads from the data link layer of each session are retained. The sessions are cut to a fixed length, zero-padded for deficiency, and reshaped into a two-dimensional grayscale matrix line by line. Byte values are mapped to grayscale values to obtain traffic grayscale images. The upper limit of the number of sessions is set according to the device category, the session with the largest byte amount is retained, and categories below a threshold value are removed to obtain a balanced training set. The traffic grayscale images are input into a two-dimensional convolutional neural network composed of multiple convolutional blocks and a classification module, and the posterior probability of each category is output. During identification, real-time traffic is processed in the same way to obtain an image to be identified and input into the trained network. The device category is determined and output according to the posterior probability. This method eliminates manual feature engineering and can achieve fine-grained and high data efficiency identification under the conditions of coexistence of background traffic, imbalance of categories, and cross-environment and cross-dataset.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the technical field of network security, and in particular to a method for identifying sensing service devices based on traffic images and convolutional neural networks. Background Technology

[0002] Sensing service devices refer to sensing service terminals / monitoring and sensing devices (i.e., IoT terminals connected to communication networks) that are connected to the network and can be detected by network traffic monitoring. They are widely deployed in smart homes, healthcare, industrial automation, and smart cities. These devices are typically resource-constrained, lack robust security mechanisms, and are difficult to patch. Accurately identifying the types of sensing service devices connected to the network is a fundamental prerequisite for implementing access control, anomaly detection, vulnerable asset monitoring, and digital forensics. Sensing service devices are highly heterogeneous in hardware, software, and communication protocols, often exhibiting periodic low-traffic communication and operating in a dynamic environment with frequent additions and removals of devices, making identification challenging.

[0003] Among existing passive traffic identification methods, rule-based methods rely on predefined behavioral features and have weak generalization ability to unlisted devices. Traditional supervised learning methods rely on flow-level statistical features or protocol fields such as traffic volume, duration, and number of packets, requiring manual feature engineering and potentially losing discriminative information from the original payload. In recent years, a new approach has emerged that organizes network traffic bytes or sessions into fixed-size grayscale images and then uses convolutional neural networks for classification. This approach has been used for tasks such as malicious traffic detection and communication protocol identification, and some solutions have also been attempted for device identification.

[0004] However, the aforementioned image-based approaches still suffer from common shortcomings when it comes to fine-grained identification of sensing service devices: First, some solutions only select traffic from a single transport layer protocol or use a single data packet as a unit, and strip away the data link layer, network layer, transport layer header, and even application layer payload during preprocessing, losing the complete spatial structure that reflects the differences between the device's protocol stack and firmware implementation; Second, the number of sessions for different device types in real networks is naturally extremely unbalanced, with some categories having only a handful of samples, and existing solutions lack category governance methods that match the image-based input, making it difficult for the model to extract discriminative features from rare categories; Third, real networks contain background traffic from non-sensing service devices such as mobile terminals and information technology equipment, and existing solutions do not provide training organization methods to improve the ability to resist background traffic interference, resulting in a significant performance degradation when crossing environments and datasets.

[0005] The information disclosed in this background section is intended only to enhance the understanding of the overall background of the invention and should not be construed as an admission or in any way implying that the information constitutes prior art known to those skilled in the art. Summary of the Invention

[0006] The purpose of this invention is to provide a method for identifying sensing service devices based on traffic images and convolutional neural networks. This method can eliminate the need for manual feature engineering and achieve robust and data-efficient fine-grained identification of sensing service devices under conditions of coexisting background traffic, imbalanced device category samples, and cross-environment and cross-dataset scenarios.

[0007] To achieve the above objectives, this invention provides a method for identifying sensing service devices based on traffic flow images and convolutional neural networks, including training phases S1-S4 and identification phases S5-S6:

[0008] S1: Obtain historical network traffic data of the communication network where the sensing service device is located, divide the historical network traffic data according to the two-way communication session to obtain several network sessions, and retain all network protocol layer payloads of each network session from the data link layer.

[0009] S2: For each network session, a fixed-length byte sequence is extracted along the byte arrangement direction. The part exceeding the fixed length is truncated, and the part insufficient is padded with zeros. The fixed-length byte sequence is then reshaped into a two-dimensional grayscale matrix row by row according to a preset number of rows and columns. The byte values ​​are mapped to the grayscale values ​​of the corresponding pixels in the two-dimensional grayscale matrix to obtain the grayscale image of the traffic used for training.

[0010] S3: Count the number of network sessions according to the candidate sensing service device category, set an upper limit for the number of sessions for each candidate sensing service device category, and when the number of network sessions in a category exceeds the upper limit, retain the network session with the largest byte size, and remove the categories with the number of network sessions below the first threshold to obtain a category-balanced training set.

[0011] S4: The training grayscale image is input into a two-dimensional convolutional neural network for training. The two-dimensional convolutional neural network includes multiple convolutional blocks stacked in sequence and a classification module located after the multiple convolutional blocks. The multiple convolutional blocks are convolutionally processed and downsampled layer by layer to extract hierarchical spatial features. The classification module flattens the hierarchical spatial features into a one-dimensional feature vector and outputs the posterior probability of each candidate sensing service device category after fully connected processing and normalized exponential operation.

[0012] S5: The real-time collected network traffic is processed in the same way as steps S1 to S2 to obtain a grayscale image of the traffic to be identified. The grayscale image of the traffic to be identified is then input into the trained two-dimensional convolutional neural network to obtain the posterior probability of each candidate sensing service device category.

[0013] S6: Determine the category of the sensing service device to which the network session to be identified belongs based on the posterior probability, and output the sensing service device identification result.

[0014] In one embodiment of the present invention, in step S1, the network session refers to a complete bidirectional communication process between the same terminal and the same peer; retaining all network protocol layer payloads of each network session from the data link layer includes using full protocol layer slicing, retaining all original bytes from the data link layer, network layer, transport layer to the application layer, without stripping the message header and application layer payload, and extracting each data packet into an independent file, identifying and removing network sessions with duplicate content.

[0015] In one embodiment of the present invention, in step S1, after obtaining historical network traffic data, data format unification and integrity verification are performed: the data packet format is converted into a unified format, the file size is checked first to remove empty files or zero-byte files, the magic number of the preset bytes at the beginning of the file is read to determine the file format, and files whose magic number cannot be recognized are marked and removed.

[0016] In one embodiment of the present invention, in step S2, the fixed-length byte sequence is 784 bytes, and the preset number of rows and columns is 28 rows and 28 columns; mapping byte values ​​to corresponding pixel grayscale values ​​includes: 0x00 corresponds to grayscale 0, 0xFF corresponds to grayscale 255, and intermediate values ​​are linearly corresponding; before being fed into the two-dimensional convolutional neural network, the grayscale values ​​are normalized to the [0,1] interval.

[0017] In one embodiment of the present invention, in step S3, the upper limit of the number of sessions is no more than 60,000 sessions per category. When the upper limit is exceeded, the session with the largest byte size is retained first, and the upper limit processing is performed on the sessions before fixed-length truncation. The first threshold is 50. When the number of grayscale images of training traffic generated for a certain category is less than 50, the entire category is deleted and does not participate in subsequent training.

[0018] In one embodiment of the present invention, in step S4, the training is organized in a progressive manner according to the complexity of the interference traffic, including: a baseline scenario of training and testing on pure sensing service device traffic; a co-domain control scenario of training and testing under the same interference environment; a zero-sample scenario of training on pure sensing service device traffic and testing in a scenario with interference; and a migration scenario of first training on data containing simpler first interference traffic and then testing in a scenario containing more complex mixed interference traffic; wherein the first interference traffic is traffic generated by smartphones, tablets and Bluetooth devices, the second interference traffic is information technology device traffic generated by laptops, and one configuration of the migration scenario is to train on data containing sensing service device traffic and first interference traffic, and then use it for a mixed scenario in which sensing service device traffic and first interference traffic and second interference traffic are superimposed.

[0019] In one embodiment of the present invention, in step S4, the plurality of convolutional blocks are three convolutional blocks, each convolutional block including a convolutional layer, a ReLU activation function and a max pooling layer; the first convolutional block uses 32 3×3 convolutional kernels and fills them in the same way, and outputs a 14×14×32 feature tensor after ReLU activation and 2×2 max pooling; the second convolutional block uses 64 3×3 convolutional kernels and outputs a 7×7×64 feature tensor; the third convolutional block uses 128 3×3 convolutional kernels and outputs a 3×3×128 feature tensor.

[0020] In one embodiment of the present invention, the classification module includes a flattening layer, a fully connected layer, a regularization layer with a dropout rate of 0.5, and an output layer. The flattening layer flattens a 3×3×128 three-dimensional feature tensor into a 1152-dimensional one-dimensional feature vector. The hidden layer of the fully connected layer contains 256 neurons and is activated by ReLU. The number of neurons in the output layer is equal to the number of candidate device categories, and the output layer outputs the posterior probability of each category through a softmax normalized exponential function.

[0021] In one embodiment of the present invention, in step S4, the Adam optimizer and sparse class cross-entropy loss function are used, the batch size is 64, the number of training rounds is 50, and the test set is used as the validation set.

[0022] In one embodiment of the present invention, in step S6, the candidate category with the largest value in the posterior probability is taken as the category of the sensing service device to which the network session to be identified belongs, the sensing service device identification result is output, and the sensing service device identification result is connected to at least one of access control, anomaly detection, vulnerable asset monitoring or digital forensics.

[0023] Compared with existing technologies, the perception service device identification method based on traffic images and convolutional neural networks according to the present invention takes a complete bidirectional network session between the same terminal and the same peer as a unit and completely preserves all network protocol layer payloads from the data link layer. It truncates the payloads to a fixed length, pads them with zeros, and reshapes them line by line into a two-dimensional grayscale image. Then, a two-dimensional convolutional neural network learns end-to-end. This avoids the loss of device protocol stack and firmware implementation information caused by using individual data packets as units, stripping the packet header, or selecting only a single protocol. It also encodes the inherent differences of devices, such as protocol combinations, options, and negotiation fields in the session header, into a two-dimensional spatial structure. Furthermore, it eliminates the need for manual design of flow-level statistics. In terms of feature acquisition, the network can automatically learn discriminative features from local byte patterns to higher-level device semantics. Furthermore, by setting an upper limit on the number of sessions based on device category, retaining the sessions with the largest byte size and removing categories with too few samples, the model can still stably learn rare categories even under real traffic conditions where category samples are naturally extremely imbalanced, and can also achieve high recognition rates for low-resource categories. Finally, the network consists of only two-dimensional convolutions and fully connected layers, has a simple structure, fast training convergence, and the recognition preprocessing is consistent with the training. It can generalize to static and dynamic environments with frequent additions and deletions of devices and to datasets from different sources without domain adaptation, and has the advantages of high recognition accuracy, high data efficiency, robustness, and strong deployability. Attached Figure Description

[0024] Figure 1 This is a flowchart illustrating the sensing service device identification method based on traffic images and convolutional neural networks according to the present invention.

[0025] Figure 2 This is a schematic diagram illustrating the reshaping of a fixed-length byte sequence of a network session into a traffic grayscale image according to the present invention.

[0026] Figure 3 This is a schematic diagram of the structure of a two-dimensional convolutional neural network model according to the present invention.

[0027] Figure 4a This is a schematic diagram of the loss of the two-dimensional convolutional neural network model according to the present invention in 6 rounds.

[0028] Figure 4b This is a line graph showing the accuracy of the two-dimensional convolutional neural network model according to the present invention in 6 rounds.

[0029] Figure 5 This is a schematic diagram of the confusion matrix for fine-grained perception service device identification under clean conditions using a two-dimensional convolutional neural network model according to the present invention.

[0030] Figure 6 This is a comparison chart of the overall performance of the two-dimensional convolutional neural network model according to the present invention in six experimental scenarios.

[0031] Figure 7 This is a schematic diagram showing the F1 score distribution of the two-dimensional convolutional neural network model according to the present invention across various device categories under six experimental configurations.

[0032] Figure 8 This is a comparison chart of the overall accuracy of the two-dimensional convolutional neural network model according to the present invention under four experimental configurations.

[0033] Figure 9 This is a comparison chart of the overall performance of the two-dimensional convolutional neural network model according to the present invention on three datasets. Detailed Implementation

[0034] The specific embodiments of the present invention will now be described in detail with reference to the accompanying drawings, but it should be understood that the scope of protection of the present invention is not limited to the specific embodiments.

[0035] Unless otherwise expressly stated, throughout the specification and claims, the term "comprising" or its variations such as "including" or "comprises" shall be understood to include the stated elements or components without excluding other elements or other components.

[0036] like Figure 1 As shown, the perception service device identification method based on traffic images and convolutional neural networks according to a preferred embodiment of the present invention includes training phases S1-S4 and identification phases S5-S6. Specifically, the identification method includes the following steps:

[0037] S1: Obtain historical network traffic data of the communication network where the sensing service device is located, divide the historical network traffic data according to the two-way communication session to obtain several network sessions, and retain all network protocol layer payloads of each network session from the data link layer.

[0038] This step is used to acquire historical network traffic data of the perception service device network during the training phase, complete the standardization and integrity verification of packet capture format, organize continuous packet capture data into a network session that reflects a complete interaction of the device, and completely preserve the device protocol stack information.

[0039] The specific steps of step S1 are as follows:

[0040] S101: Perform data format unification and integrity verification, and convert the data packet format into a unified format.

[0041] The raw packet capture data may be in PCAP or PCAPNG format. If the data packets are already in standard PCAP format, no conversion is needed; if they are in PCAPNG format, they must be uniformly converted to PCAP format to ensure compatibility with subsequent processing tools. Format conversion is performed using the command-line tool editcap in the Wireshark suite. The specific process is as follows: For each detected PCAPNG file, first, a backup copy is created in a specified backup directory to preserve the original data; then, the command `editcap -F pcap` is called to convert the file to standard PCAP format. After successful conversion, the original file is replaced. Before conversion, each file must undergo strict double integrity verification: first, the file size is checked, filtering out empty or zero-byte files; second, the first 4 bytes of the file's magic number are read and analyzed to determine the actual file format. The magic number 0A0D0D0A identifies a PCAPNG file, while A1B2C3D4 or D4C3B2A1 identifies a traditional PCAP format. Files whose magic numbers cannot be recognized are marked and discarded to ensure that only valid data packets enter the subsequent processing stage.

[0042] S102: Grouping by complete communication sessions, multiple data packets belonging to the same bidirectional communication process are merged into a single network session. This communication session refers to a complete bidirectional communication process between the same terminal and the same peer. At the feature level, all-layer slicing is employed, preserving all raw bytes from the data link layer, network layer, transport layer to the application layer without stripping the header and application layer payload. Simultaneously, each data packet is extracted into a separate file to retain fine-grained information for auxiliary analysis; subsequently, duplicate session files are identified and removed.

[0043] The specific process is as follows: Use the packet splitting tool SplitCap to split the PCAP file into smaller units, use the fdupes tool to identify and remove duplicate files, complete session grouping, and use a duplicate file identification tool to complete deduplication. Other equivalent tools can also be used.

[0044] Step S1 ensures that subsequent session segmentation and image processing are independent of specific packet capture sources through standardized formatting. It also eliminates corrupted or empty files as early as possible through dual verification of file size and magic number, preventing invalid data from polluting the training set. Using complete bidirectional sessions rather than individual data packets as units allows for simultaneous handling of request and response interactions, preserving all original bytes from the data link layer to the application layer. This avoids the loss of inherent device information caused by removing headers, cleaning application layers, or only using a single transport layer protocol. It fully encodes the differences in device protocol stacks and firmware implementations, such as protocol combinations, options, and negotiation fields in the session header, into a spatial structure, providing an informational foundation for cross-environment generalization. Deduplication eliminates redundancy caused by identical sessions, reducing the bias of repeated samples on training.

[0045] S2: For each network session, a fixed-length byte sequence is extracted along the byte arrangement direction. Parts exceeding the fixed length are truncated, and parts below the fixed length are padded with zeros. The fixed-length byte sequence is then reshaped row by row into a two-dimensional grayscale matrix according to a preset number of rows and columns. The byte values ​​are mapped to the grayscale values ​​of the corresponding pixels in the two-dimensional grayscale matrix to obtain a grayscale image of the training traffic. This image is used to establish a mapping between network sessions of arbitrary length and the input of a two-dimensional convolutional neural network.

[0046] Specifically, step S2 includes:

[0047] S201: Each network session is pruned to a fixed 784 bytes along the byte order. Any portion exceeding 784 bytes is truncated, and any portion less than 784 bytes is padded with hexadecimal zeros to ensure a uniform input dimension. The pruned sessions are then randomly divided into training and testing sets according to device category using a 90 / 10 split ratio.

[0048] S202: Each 784-byte session is filled into a row of 28 bytes in sequence, and the rows are reshaped into a two-dimensional grayscale matrix of 28 rows and 28 columns (28×28). The value of each byte corresponds one-to-one with the grayscale of the pixel, that is, 0x00 corresponds to grayscale 0 (black), 0xFF corresponds to grayscale 255 (white), and intermediate values ​​correspond linearly. It is saved as a PNG format with the help of Python Imaging Library (PIL). This mapping is not a predefined conversion table, nor is it calculated by additional formulas, but a direct mapping from byte value to pixel intensity.

[0049] S203: Before feeding the two-dimensional convolutional neural network, the gray values ​​are normalized to the [0,1] range, and then saved as a portable network graphics format file using an image library. At the same time, a class mapping file (class_mapping_initial.json) is generated to establish the correspondence between the numerical index and the original device name, laying the foundation for subsequent class imbalance processing.

[0050] This step also compiles the PNG format into the standard MNIST binary format (IDX file format), which is widely used in deep learning research. Simultaneously, it counts the number of grayscale images generated for training in each category. If a category generates fewer than 50 image samples, the entire category is deleted and not used in subsequent training and evaluation.

[0051] This step S2 fixed-length pruning ensures that sessions of different lengths have a consistent input dimension. Since the effective information of a session is mostly concentrated at the beginning, truncating the first few bytes and padding the missing parts with zeros can reduce the loss of effective information while unifying the dimension. Reshaping the one-dimensional byte sequence into a two-dimensional grayscale matrix gives the original binary traffic a two-dimensional spatial structure, allowing mature two-dimensional convolutional neural networks to automatically learn edge, texture, and high-level semantic features, eliminating the need for manual design of flow-level statistical features. The row-by-row fixed-length reshaping and direct mapping are simple, reversible, and do not introduce human feature bias. Normalizing the data to the [0,1] interval before sending it to the network is beneficial for numerical stability and training convergence under different magnitudes of input.

[0052] S3: Count the number of network sessions by candidate sensing service device category. Set an upper limit on the number of sessions for each candidate sensing service device category. When the number of network sessions for a category exceeds the upper limit, retain the network session with the largest byte size, and remove categories with fewer than the first threshold to obtain a class-balanced training set. This step is used to count the number of network sessions by candidate sensing service device category, control the sample size of each category, and remove rare categories that cannot support model learning to obtain a class-balanced training set.

[0053] Specifically, step S3 includes: setting an upper limit on the number of network sessions corresponding to each candidate sensing service device category, preferably no more than 60,000 sessions per category. When the upper limit is exceeded, the session with the largest number of bytes is retained first. This upper limit processing is performed on the sessions before fixed-length pruning.

[0054] Step S3 controls the data size and computational cost by setting a category upper limit and retaining the session with the largest number of bytes, while preserving the most information-rich session within a limited quota. Some categories have only a few samples in the original data, making it difficult for two-dimensional convolutional neural networks to extract meaningful and discriminative features. Eliminating categories with fewer than the first threshold can prevent the model from producing unreliable outputs on unlearnable categories, thereby reducing the number of categories, improving category balance, and resulting in a more robust model training and evaluation set.

[0055] S4: The grayscale images of the traffic flow are input into a two-dimensional convolutional neural network for training. The two-dimensional convolutional neural network includes multiple stacked convolutional blocks and a classification module following these blocks. The convolutional blocks perform convolution and downsampling layer by layer to extract hierarchical spatial features. The classification module flattens these hierarchical spatial features into a one-dimensional feature vector and outputs the posterior probability of each candidate sensing service device category after fully connected processing and normalized exponential operation. This step is used to build an end-to-end network from the grayscale images of the traffic flow to the posterior probability of the device category. Training is completed on a class-balanced training set, and transferable robustness is obtained through a progressive organization of perturbation traffic complexity.

[0056] Specifically, the two-dimensional convolutional neural network in step S3, in terms of network construction, such as... Figure 3 As shown, the network input is a 28×28×1 grayscale image of traffic. The convolutional feature extraction part consists of three convolutional blocks stacked sequentially. Each convolutional block contains a convolutional layer, a ReLU activation function, and a max pooling layer. The first convolutional block uses 32 3×3 convolutional kernels and fills them in the same way. After ReLU activation and 2×2 max pooling, it outputs a 14×14×32 feature tensor. The second convolutional block uses 64 3×3 convolutional kernels and outputs a 7×7×64 feature tensor. The third convolutional block uses 128 3×3 convolutional kernels and outputs a 3×3×128 feature tensor. In the classification module, the flattening layer flattens the 3×3×128 three-dimensional feature tensor into a 1152-dimensional one-dimensional feature vector. The hidden layer of the fully connected layer contains 256 neurons and uses ReLU activation. After that, a regularization layer with a dropout rate of 0.5 is set. The number of neurons in the output layer is equal to the number of candidate device categories, and the posterior probability of each category is output after passing through the softmax normalized exponential function.

[0057] In terms of training configuration, the Adam optimizer and sparse class cross-entropy loss function were adopted, with a batch size of 64 and 50 training rounds. The test set was also used as the validation set. During training, the model converged quickly in the first few rounds, and the accuracy reached 0.999 by the fifth round of testing. The training and testing performance closely followed each other, and there was no overfitting.

[0058] In terms of anti-interference progressive migration, training and testing are organized according to four scenarios: baseline, co-domain control, zero-shot, and migration. The baseline scenario is trained and tested on pure sensing service device traffic; the co-domain control scenario is trained and tested under the same interference environment; the zero-shot scenario is trained on pure sensing service device traffic and tested in a scenario with interference; the migration scenario is first trained on data containing relatively simple first interference traffic and then tested in a scenario containing more complex mixed interference traffic. Interference traffic is injected in a three-step progressive manner. The first step is to collect the baseline traffic of 23 devices under normal use conditions. The second step is to introduce smartphones and tablets to send instructions to the sensing service device and to periodically synchronize with Bluetooth devices to inject noise. The third step is to connect a laptop to carry out routine activities to eliminate sensitive tasks. Correspondingly, the first interference traffic is the traffic generated by mobile terminals such as smartphones, tablets, and Bluetooth devices, and the second interference traffic is the traffic generated by information technology devices such as laptops. One migration configuration is to train with data of sensing service device plus mobile terminal traffic and then use it for a mixed scenario of sensing service device plus mobile terminal traffic and information technology traffic superimposed.

[0059] Step S4 increases the number of convolutional kernels in the three convolutional blocks from 32 to 128 and uses spatial downsampling to abstract local byte patterns to higher-level device semantics layer by layer across different receptive fields. All convolutional layers use a `padding='same'` padding strategy to preserve boundary information. Max pooling reduces dimensionality, expands the receptive field, and suppresses overfitting. Fully connected hidden layers and regularized layers with a dropout rate of 0.5 balance expressive power and generalization ability. The network consists only of two-dimensional convolutions and fully connected layers, eliminating the need for recurrent networks or manual features. It is end-to-end trainable and converges quickly using Adam, sparse class cross-entropy, and a fixed batch size and number of epochs. Furthermore, the progressive transfer from simple to complex interference makes the learned device features transferable priors, which better suppresses background traffic misjudgments and improves anti-interference ability compared to the zero-shot approach.

[0060] S5: The real-time collected network traffic is processed in the same way as steps S1 to S2 to obtain a grayscale image of the traffic to be identified. The grayscale image of the traffic to be identified is input into the trained two-dimensional convolutional neural network to obtain the posterior probability of each candidate sensing service device category. This probability is used to apply the trained two-dimensional convolutional neural network to online identification during the identification stage.

[0061] Specifically, step S5 includes: for the real-time collected network traffic, performing packet capture format unification, bidirectional communication session division, full protocol layer preservation, fixed-length pruning, two-dimensional grayscale reshaping and normalization processing in the same manner as steps S1 to S2 to obtain a grayscale image of the traffic to be identified; inputting the grayscale image of the traffic to be identified into a trained two-dimensional convolutional neural network, extracting hierarchical spatial features from multiple convolutional blocks, and obtaining the posterior probability of each candidate sensing service device category through a classification module.

[0062] like Figure 2As shown, grayscale images from different device categories exhibit significant differences in texture, contrast, and spatial distribution. Specifically, devices with similar communication behaviors and protocol stack architectures (such as the voice assistants Amazon Echo, Echo Dot, and Google Home Mini) display visually similar overall structures and grayscale distributions; while devices with significantly different functions and application scenarios (such as the Philips Hue smart lighting system and the Ring Doorbell) produce distinctly different image patterns. This visual diversity is not accidental but fundamentally reflects the inherent differences in the communication mechanisms of different sensing service devices, including but not limited to the choice of transmission protocols (such as HTTP, MQTT, and CoAP), packet payload padding structure, communication frequency and timing characteristics, and device firmware-specific data exchange formats. Furthermore, even devices from the same manufacturer or product line exhibit discernible differences in their image representations. For example, although Amazon Echo and Echo Dot belong to the Amazon smart speaker family and share highly similar communication protocols and application scenarios, their grayscale images still exhibit distinguishable features in terms of local texture details and pixel distribution. This observation demonstrates that spatial coding methods based on byte-level payloads possess sufficient representational sensitivity to capture subtle differences in the software and hardware implementations of individual devices, including variations in driver logic, firmware versions, and background service communication behavior. This fine-grained discriminative capability is invaluable for accurate device identification in real-world deployments, especially given the continuous evolution and increasing homogenization of device models.

[0063] The visualization results described above provide strong qualitative support for the core hypothesis of this study: when the original network traffic payload is reorganized into a spatial matrix representation, device-specific discriminative information can be effectively preserved without losing key distinguishing features due to format conversion. The visual separability observed in the figure further indicates that traffic data from different device categories naturally form separable manifold structures in the spatial domain, which lays a solid foundation for the subsequent introduction of convolutional neural networks for automatic feature extraction and classification. As a deep model inherently suited for processing grid-like data structures such as images, convolutional neural networks can abstract hierarchical features (including local textures, edges, and global layout patterns) through multi-layer convolution and pooling operations, thereby achieving end-to-end device recognition without the need for manual feature engineering and fully utilizing the spatial information encoded in grayscale image representations.

[0064] The reasoning process in step S5 is completely consistent with the training preprocessing, avoiding the distribution deviation caused by the inconsistency between training and recognition standards, and eliminating the need to extract manual features from real-time traffic, making it easy to execute automatically on gateways or bypass links.

[0065] S6: Determine the category of the sensing service device to which the network session to be identified belongs based on the posterior probability, and output the identification result of the sensing service device. This is used to transform the posterior probability into an identification result that can be used for security management during the identification stage.

[0066] Specifically, in step S6, the candidate category with the largest value in the output layer posterior probability is taken as the category of the sensing service device to which the network session to be identified belongs. The result output module outputs the identification result of the sensing service device, and can be further integrated with security processing such as access control, anomaly detection, vulnerable asset monitoring and digital forensics.

[0067] Step S6 uses normalized posterior probability as the basis for decision-making. The output includes both the determined category and the confidence level, which facilitates the setting of thresholds and connection with downstream security actions, so that the identification results can directly serve equipment access and anomaly monitoring.

[0068] Example

[0069] To comprehensively evaluate the effectiveness of the proposed method, extensive experiments were conducted on two publicly available benchmark datasets: the R+R dataset and the Mon(IoT)r dataset. The R+R dataset was collected from a testbed simulating a real apartment environment, containing 23 commercial sensing service devices and distinguishing between static and dynamic environment configurations. In the static environment, the set of active devices remained unchanged during the data collection period. In the dynamic environment, devices were randomly connected and disconnected, new sensing service devices were added, and multiple mobile devices with accompanying applications were used to operate the sensing service devices. The Mon(IoT)r dataset was collected from two laboratory testbeds in the United States and the United Kingdom, covering a total of 81 commercial sensing service devices and distinguishing between US and UK subsets.

[0070] These two datasets differ significantly in device configuration, data acquisition process, and underlying network environment, providing a rigorous and comprehensive testing platform for evaluating the model's generalization ability. To further examine the model's robustness under real-world network conditions, it was evaluated on the R+R dataset based on a series of challenging scenarios from previous work. These scenarios reflect common practical difficulties in deploying real-world sensing service devices and have been shown to significantly degrade the performance of traditional machine learning-based recognition methods. This comparison allows for the quantification of the impact of each real-world factor on performance and determines whether the image-based representation is robust enough to support real-world deployment.

[0071] The evaluation metrics are based on a confusion matrix and use accuracy. Accuracy Recall rate With F1 score ,in To correctly identify, To correctly eliminate, For false alarms, To prevent underreporting, both macro average and weighted average are provided: the macro average is calculated independently for each category and then the arithmetic mean is taken, and each category is assigned the same weight; the weighted average is weighted according to the proportion of real samples in each category; the rows of the confusion matrix represent the real category and the columns represent the predicted category, which is used to identify easily confused devices; all the following metrics are based on the above-mentioned public dataset.

[0072] The training and validation performance of the two-dimensional convolutional neural network of this invention is as follows: Figure 4a and Figure 4b As shown in the figure, the training and validation performance across six epochs includes training loss, test loss, training accuracy, and test accuracy. As the figure shows, the model achieves rapid convergence in the initial few epochs. In epoch 0, both the training loss and test loss are approximately 0.79, corresponding to an accuracy of 0.88, indicating a reasonable initial state. By epoch 1, the training loss drops sharply to 0.02, and the test loss decreases simultaneously to the same value, while both training and test accuracies rise to 0.98, indicating that the model quickly captures potential discrimination patterns in the data. From epoch 2 onwards, the loss continues to decrease slightly, with both training and test losses reaching 0.01, while the accuracy remains close to 1.0. In epoch 4, the test accuracy reaches 0.998; by epoch 5, the model achieves a test accuracy of 0.999 and a training accuracy of 0.998, with both losses stabilizing at 0.01.

[0073] Throughout the training process, the test loss and test accuracy closely followed the performance on the training set, showing no signs of overfitting. The near-consistent performance on the training and test sets demonstrates the model's effective generalization to unseen data. Smooth and consistent convergence behavior further validates the effectiveness of the proposed image-based representation method and 2D convolutional neural network architecture in the identification of sensing service devices. Similar training and convergence behaviors were observed on the US and UK subsets of the Mon(IoT)r dataset, both exhibiting almost identical fast convergence patterns, achieving test accuracy exceeding 99% within 5 epochs, and showing no signs of overfitting. This further demonstrates that the proposed method maintains stable learning ability and good generalization performance on sensing service device traffic data across different geographical regions.

[0074] In fine-grained recognition under clean conditions, the method in this application achieves an overall accuracy of 99.61%, a weighted average F1 score of 99.61%, and a macro-average F1 score of 99.31% on 20 classes of the R+R dataset. Precision and recall are both 99.6%, and the F1 score is 99.3%. Compared with six existing methods (IoT Sentinel, MUDgee, Your Smart Home, IoTDevID, genIoTID, and Devicemein) on the same dataset and under the same settings, the method in this application achieves the highest levels in precision, recall, and F1 score. Specifically, compared with IoTDevID, which is also based on deep learning, both methods achieve comparable performance and significantly outperform traditional methods, indicating that the deep learning architecture itself is a key driving factor for this task. The performance comparison between this invention and the six existing methods is shown in the table below.

[0075] Table 1: Performance Comparison of Identification Methods for Different Sensing Service Devices

[0076] method Accuracy Recall rate F1 score Iot Sentinel 0.780 0.709 0.729 MUDgee 0.853 0.789 0.79 Your Smart Home 0.942 0.926 0.928 IoTDevID 0.995 0.995 0.994 genIoTID 0.882 0.846 0.845 Devicemein 0.575 0.664 0.602 This invention 0.996 0.996 0.993

[0077] Figure 5 The diagram shows a fine-grained classification confusion matrix for 20 categories of sensing service devices. The vertical axis represents the true label, and the horizontal axis represents the predicted label. The diagonal elements represent the number of correctly classified samples. It is clear from the matrix that the vast majority of samples are concentrated on the diagonal, while the off-diagonal elements are almost all zero. This intuitively verifies the superior performance of the proposed method in fine-grained sensing service device identification. Specifically, for device categories with larger sample sizes (including Samsung Fridge (1,778 samples), Amazon Echo (617 samples), Google Home Mini (778 samples), and Chromecast V3 (320 samples)), near-perfect classification is achieved, with only a very small number of samples misclassified. For categories with significantly smaller sample sizes, such as Calex motion sensor (17 samples), Princess smart aerofryer (23 samples), and Salcarradiator thermostat (22 samples), the model also achieves zero misclassifications, fully demonstrating its strong discriminative ability even in low-resource scenarios. Figure 5The 20 categories of sensing service devices are as follows: Amazon Echo, Bosch Dishwasher, Calex Motion Sensor, Calex Slimme LED Vloerlamp, Chromecast v3, EchoDot, Google Home Mini, Google Nest Cam, ILIFE T10s, Philips HUE, Philips Luchtreiniger 600-Serie, Philips TV, PNI Safe House PG600LR Safety Alarm, Princess Smart Aerofryer, Ring Doorbell, SALCAR Radiatorthermostaat TRV801W, Samsung Fridge, Smartplug HS110, Smartplug KP105, and WellToBe Pet Feeder.

[0078] Figure 5 In the dataset, a few misclassifications consistently occurred between devices with similar functions or from the same brand. For example, a small number of EchoDot samples were misclassified as Amazon Echo, both being smart speakers from the same brand with highly overlapping underlying operating systems and communication protocols. In such cases, confusion regarding traffic features is to be expected. Aside from these isolated cases, there were no instances of cross-category misclassification in the confusion matrix, such as misclassifying a smart plug as a camera or a sensor as a speaker. This indicates that the traffic-image features learned by the model encode clear physical semantics, closely aligned with the functional categories of the devices, rather than merely capturing superficial statistical patterns in the dataset.

[0079] Table 2 Performance Indicators for Each Category of Sensing Service Device Identification

[0080] equipment accuracy Recall rate F1 score Sample size amazon_echo 0.9936 1.0000 0.9968 617 bosh_diswasher 1.0000 1.0000 1.0000 40 calex_motion_sensor 1.0000 1.0000 1.0000 17 calex_slimme_led_vloerlamp 1.0000 1.0000 1.0000 52 chromecast_v3 1.0000 0.9969 0.9984 320 echo_dot 0.9778 0.9724 0.9751 181 google_home_mini 0.9974 0.9974 0.9974 778 google_nest_cam 1.0000 1.0000 1.0000 178 ilife-t10s 0.9823 0.9652 0.9737 115 philips_hue 1.0000 1.0000 1.0000 170 philips_luchtreiniger_600-serie 1.0000 0.9677 0.9836 31 philips_tv 0.9322 0.9649 0.9483 57 pni_safe_house_pg600lr 1.0000 1.0000 1.0000 40 princess_smart_aerofryer 1.0000 1.0000 1.0000 23 ring_doorbell 1.0000 1.0000 1.0000 34 salcar_radiatorthermostaat_trv801w 1.0000 1.0000 1.0000 22 samsung_fridge 0.9989 0.9989 0.9989 1778 smartplug-hs100 1.0000 0.9811 0.9905 53 smartplug-kp105 1.0000 1.0000 1.0000 41 welltobe_pet_feeder 1.0000 1.0000 1.0000 51 Overall classification accuracy 0.9961 4577 Macro average 0.9941 0.9922 0.9931 4577 > - Weighted average 0.9961 0.9961 0.9961 4577

[0081] Table 2 shows the precision, recall, and F1 score for all 20 categories of sensing service devices. The overall classification accuracy reached 99.61%, with weighted average and macro-average F1 scores of 99.61% and 99.31%, respectively, further validating the effectiveness of the method. For large-scale device categories, the model consistently performed excellently. The Samsung Fridge (1,778 samples), with the largest sample size, achieved a near-perfect F1 score of 99.89%. Similarly, Amazon Echo (617 samples), Google Home Mini (778 samples), and Chromecast V3 (320 samples) all achieved F1 scores exceeding 99.6%, demonstrating robust classification performance on sufficiently representative categories. Furthermore, the model also performed exceptionally well on minority classes. The classes with very small sample sizes (Calex motion sensor (17 samples), Princess smart aerofryer (23 samples), and Salcar radiator thermostat (22 samples)) all achieved 100% precision, recall, and F1 score, indicating that the model did not experience performance degradation in low-resource environments.

[0082] In a few categories with minor flaws, Echo Dot achieved an F1 score of 97.51%, with precision and recall of 97.78% and 97.24%, respectively. This slight decrease may be attributed to its functional and brand similarity to Amazon Echo, inevitably introducing feature ambiguity. Philips TV also had a relatively low F1 score of 94.83%, primarily due to its 93.22% precision, indicating a small number of false positives that warrant further investigation. It is worth emphasizing that the vast majority of categories (15 out of 20) achieved perfect or near-perfect F1 scores exceeding 98%. Furthermore, the lowest F1 scores across all categories remained above 94%, highlighting the model's balanced and reliable performance across different types of perceived service devices, regardless of sample size or functional heterogeneity.

[0083] To address interference resistance, six experimental scenarios with progressively increasing complexity were designed, organized along two dimensions: training set composition and test set composition, to reflect real-world deployment conditions where sensing service devices coexist with other network devices. In the baseline scenario, the model was trained and tested on pure IoT traffic, establishing a performance ceiling in interference-free conditions. In the in-domain control scenario, training and testing were conducted under the same interference environment (e.g., IoT+M or IoT+M+IT) to isolate the impact of distribution offsets. In the zero-shot scenario, the model was trained on pure IoT traffic and tested in an interference-containing scenario to evaluate its generalization ability to unseen interference patterns. In the transfer scenario, the model was trained on one interference scenario (e.g., IoT+M) and tested on another different, more complex interference scenario (e.g., IoT+M+IT) to evaluate the transferability of its interference resistance. Figure 6 The overall performance comparison of six experimental scenarios is presented, with each bar representing the classification accuracy (F1 score) under the corresponding configuration. The first part evaluates the interference of non-aware service devices (smartphones, tablets, laptops, and Bluetooth devices) in a three-step progressive approach. This includes collecting baseline traffic from 23 devices under normal usage conditions, introducing instructions from smartphones and tablets to aware service devices while periodically synchronizing Bluetooth devices to inject noise, and finally connecting a laptop for routine activities (excluding sensitive tasks) to assess the extent to which coexisting consumer electronics devices interfere with IoT traffic patterns.

[0084] like Figure 6 As shown, the model achieved consistently high performance across all scenarios, with F1 scores ranging from 90.9% to 99.8%: 99.6% in the baseline scenario; 99.8% for IoT+M and 99.7% for IoT+M+IT in the same-domain control scenario; 98.3% for IoT+M and 98.6% for IoT+M+IT in the zero-shot scenario, a decrease of only about 1.5 percentage points compared to the same-domain control scenario; in the transfer scenario, training on a pure sensing service device and then applying it to IoT+M and IoT+M+IT respectively resulted in a performance of 90.9%, while training on IoT+M and then applying it to the more complex IoT+M+IT recovered to 99.0%, an improvement of 8.1 percentage points compared to the corresponding zero-shot configuration.

[0085] Figure 7The F1 scores of each device category are shown across six experimental scenarios, providing a fine-grained view of how different sensing service device types respond to various interference conditions. Most device types maintained remarkably stable performance across all six scenarios. Cameras, speakers, lights, and appliances consistently achieved F1 scores above 99% across all six configurations, indicating that these device categories generate sufficiently distinctive traffic characteristics to remain distinguishable even under severe background noise. This stability suggests that the traffic patterns of these devices, potentially characterized by periodic heartbeat messages, timed status updates, or continuous streaming, are robust to interference.

[0086] The percentage of plug-in devices decreased from 99.9% at baseline to 95.5% for IoT+M+IT (a decrease of 4.4 percentage points), and the percentage of hub-in devices decreased from 99.0% to 96.0%. Welltobe Pet Feeder showed a unique sensitivity of 1.5 percentage points to the subtle differences between IoT+M+IT and IoT→IoT+M+IT. For the most severely affected devices, the transfer configuration brought a significant improvement compared to zero samples. For example, the percentage of plug-in devices increased from 88.0% for IoT→IoT+M to 93.0% for IoT→IoT+M+IT (an improvement of 5.0 percentage points). The devices that benefited the most from this were precisely those most vulnerable to interference. These results were obtained based on the R+R dataset and the interference scenario settings described in the disclosure, demonstrating that the organizational approach of training under simpler interference and then transferring to more complex mixed interference enables the model to acquire transferable anti-interference capabilities.

[0087] In terms of cross-testing in static and dynamic environments, this embodiment conducted cross-testing experiments. The R+R dataset provides two different environment settings: in the static environment, the set of active devices remains unchanged throughout the data collection period; in the dynamic environment, devices are frequently added or removed in the network, simulating the scenario of device replacement in actual deployment. This embodiment designed four experimental configurations: (1) Static training and static testing (Static→Static), where training and testing are both performed in a static environment as a baseline within the same domain; (2) Dynamic training and dynamic testing (Dynamic→Dynamic), where training and testing are both performed in a dynamic environment; (3) Static training and dynamic testing (Static→Dynamic), where the model is trained on static data and tested on dynamic data to evaluate cross-environment generalization ability; and (4) Dynamic training and static testing (Dynamic→Static), where the model is trained on dynamic data and tested on static data. In contrast to static and dynamic environments, static scenarios maintain a constant set of devices and number of users throughout the data collection process to simulate idealized controlled conditions. Dynamic scenarios, on the other hand, involve random connection and disconnection of devices, the addition of new sensing service devices, and the installation of supporting applications on multiple mobile devices to operate the sensing service devices, thereby simulating the complex network environment in a real home characterized by device fluctuations and multi-user interactions.

[0088] Figure 8 The figure shows the overall accuracy under four configurations: 99.0% for static training and static testing, 99.4% for dynamic training and dynamic testing, 97.6% for static training and dynamic testing, and 97.2% for dynamic training and static testing. The cross-environment accuracy is only 1.4 to 2.2 percentage points lower than that in the same domain. In the categorical results, the Samsung Fridge achieved scores of 99.7%, 99.8%, 99.3%, and 99.4% in the four configurations, respectively. Devices such as the Calex Slimme LED Vloerlamp and Google Nest Cam also remained stable. Some devices experienced a decline across different environments. The Philips Hue dropped from 97.9% in static local testing and 99.6% in dynamic local testing to 94.1% in static training and dynamic testing. The Amazon Echo dropped from 99.2% in dynamic local testing to 92.6% in static training and dynamic testing. The Echo Dot dropped from 99.4% in dynamic local testing to 89.2% in dynamic training and static testing. The Philips TV plummeted from 99.2% in dynamic local testing to 56.9% in dynamic training and static testing (a decrease of 42.3 percentage points), making it a unique device highly dependent on the network environment context. The average F1 score for all devices in static training and dynamic testing was 90.9%, and in dynamic training and static testing it was 92.2%. The results above demonstrate that the model captures device-invariant features rather than environment-specific artifacts, and can generalize across environments with frequent additions and removals of devices without domain adaptation.

[0089] Regarding cross-dataset and few-sample performance, the overall performance of the proposed method is compared across three datasets: R+R (20 device types), Mon(IoT)r UK subset (25 devices), and Mon(IoT)r US subset (37 devices). Figure 9 As shown, the accuracy on the R+R dataset, the Mon(IoT)r UK subset (25 classes), and the US subset (37 classes) is 99.6%, 100.0%, and 99.9%, respectively, without the need for dataset adaptation or retraining. Statistical analysis of the relationship between F1 score and the number of training samples per class shows that devices with more than 50 training samples have F1 scores ranging from 0.98 to 1.00; several devices with fewer than 20 samples, such as wink-hub2 (12 samples), xiaomi-cleaner (6 samples), dlink-mov (7 samples), xiaomi-hub (6 samples), xiaomi-strip (8 samples), and t-wemo-plugin (10 samples), still achieve F1 scores greater than 0.95, with most approaching 1.00, and the fewest having only 6 training samples; no clear correlation between sample size and F1 score was observed in any of the three datasets, indicating that large-sample devices do not necessarily outperform devices with very small samples. The above cross-dataset results are based on the Mon(IoT)r public dataset, indicating that the performance of traffic image representation is determined by the inherent uniqueness of the traffic pattern itself rather than the amount of data, and has high data efficiency and cross-data source generalization ability.

[0090] The experimental results above confirm the advantages of this invention: First, the complete bidirectional session retains all network protocol layer payloads from the data link layer and reshapes them into a traffic image. End-to-end learning by a two-dimensional convolutional neural network eliminates the need for manual feature engineering. The confusion matrix shows no cross-class misclassification, indicating that it has learned the physical semantics corresponding to the device's function. Second, the combination of category governance and full protocol layer visualization enables low-resource categories with only a few to dozens of samples to still achieve zero misclassification or an F1 score greater than 0.95. Third, progressive transfer training from simple to complex interference enables the most complex mixed scenarios to still achieve an F1 score of 99.0%, an improvement of 8.1 percentage points compared to zero samples, with the greatest transfer gain for the most vulnerable devices. Fourth, the model only decreases by 1.4 to 2.2 percentage points across environments and achieves 99.9% to 100.0% accuracy across datasets, demonstrating good anti-interference capabilities and cross-environment and cross-dataset generalization ability.

[0091] The foregoing description of specific exemplary embodiments of the invention is for illustrative and explanatory purposes. These descriptions are not intended to limit the invention to the precise forms disclosed, and it will be apparent that many changes and variations can be made in accordance with the foregoing teachings. The exemplary embodiments were chosen and described in order to explain the specific principles of the invention and its practical application, thereby enabling those skilled in the art to implement and utilize various different exemplary embodiments of the invention, as well as various different choices and variations. The scope of the invention is intended to be defined by the claims and their equivalents.

Claims

1. A method for identifying sensing service devices based on traffic flow images and convolutional neural networks, characterized in that, Includes training phases S1-S4 and recognition phases S5-S6: S1: Obtain historical network traffic data of the communication network where the sensing service device is located, divide the historical network traffic data according to the two-way communication session to obtain several network sessions, and retain all network protocol layer payloads of each network session from the data link layer. S2: For each network session, a fixed-length byte sequence is extracted along the byte arrangement direction. The part exceeding the fixed length is truncated, and the part insufficient is padded with zeros. The fixed-length byte sequence is then reshaped into a two-dimensional grayscale matrix row by row according to a preset number of rows and columns. The byte values ​​are mapped to the grayscale values ​​of the corresponding pixels in the two-dimensional grayscale matrix to obtain the grayscale image of the traffic used for training. S3: Count the number of network sessions according to the candidate sensing service device category, set an upper limit for the number of sessions for each candidate sensing service device category, and when the number of network sessions in a category exceeds the upper limit, retain the network session with the largest byte size, and remove the categories with the number of network sessions below the first threshold to obtain a category-balanced training set. S4: The training traffic grayscale image is input into a two-dimensional convolutional neural network for training. The two-dimensional convolutional neural network includes multiple convolutional blocks stacked in sequence and a classification module located after the multiple convolutional blocks. The multiple convolutional blocks are convolutionally processed and downsampled layer by layer to extract hierarchical spatial features. The classification module flattens the hierarchical spatial features into a one-dimensional feature vector and outputs the posterior probability of each candidate sensing service device category after fully connected processing and normalized exponential operation. S5: The real-time collected network traffic is processed in the same way as steps S1 to S2 to obtain a grayscale image of the traffic to be identified. The grayscale image of the traffic to be identified is then input into the trained two-dimensional convolutional neural network to obtain the posterior probability of each candidate sensing service device category. S6: Determine the category of the sensing service device to which the network session to be identified belongs based on the posterior probability, and output the sensing service device identification result.

2. The method for identifying sensing service devices based on traffic flow images and convolutional neural networks as described in claim 1, characterized in that, In step S1, the network session refers to a complete bidirectional communication process between the same terminal and the same peer. The entire network protocol layer payload of each network session from the data link layer is retained, including full protocol layer slicing, retaining all original bytes from the data link layer, network layer, transport layer to the application layer, without stripping the message header and application layer payload, and extracting each data packet into an independent file, and identifying and removing network sessions with duplicate content.

3. The method for identifying sensing service devices based on traffic flow images and convolutional neural networks as described in claim 1, characterized in that, In step S1, after obtaining historical network traffic data, data format unification and integrity verification are performed: the data packet format is converted into a unified format, the file size is checked first to remove empty files or zero-byte files, and then the magic number of the preset bytes at the beginning of the file is read to determine the file format. Files whose magic number cannot be recognized are marked and removed.

4. The method for identifying sensing service devices based on traffic flow images and convolutional neural networks as described in claim 1, characterized in that, In step S2, the fixed-length byte sequence is 784 bytes, and the preset number of rows and columns is 28 rows and 28 columns; Mapping byte values ​​to corresponding pixel grayscale values ​​includes: 0x00 corresponds to grayscale 0, 0xFF corresponds to grayscale 255, and intermediate values ​​are linearly corresponding; before being fed into the two-dimensional convolutional neural network, the grayscale values ​​are normalized to the [0,1] interval.

5. The method for identifying sensing service devices based on traffic flow images and convolutional neural networks as described in claim 1, characterized in that, In step S3, the upper limit of the number of sessions is no more than 60,000 sessions per category. When the upper limit is exceeded, the session with the largest byte size is retained first. The upper limit processing is performed on the sessions before fixed-length truncation. The first threshold is 50. When the number of grayscale images of training traffic generated for a certain category is less than 50, the entire category is deleted and does not participate in subsequent training.

6. The method for identifying sensing service devices based on traffic flow images and convolutional neural networks as described in claim 1, characterized in that, In step S4, the training is organized in a progressive manner according to the complexity of the interference traffic, including: a baseline scenario where training and testing are performed on pure sensing service device traffic; a co-domain control scenario where training and testing are performed under the same interference environment; a zero-sample scenario where training is performed on pure sensing service device traffic and testing is performed in a scenario with interference; and a migration scenario where training is performed on data containing relatively simple first interference traffic and then testing is performed in a scenario containing more complex mixed interference traffic; wherein the first interference traffic is traffic generated by smartphones, tablets and Bluetooth devices, and the second interference traffic is information technology device traffic generated by laptops. One configuration of the migration scenario is to train on data containing sensing service device traffic and first interference traffic, and then use it for a mixed scenario where sensing service device traffic is superimposed with first interference traffic and second interference traffic.

7. The method for identifying sensing service devices based on traffic flow images and convolutional neural networks as described in claim 1, characterized in that, In step S4, the multiple convolutional blocks are three convolutional blocks, each containing a convolutional layer, a ReLU activation function, and a max pooling layer; the first convolutional block uses 32 3×3 convolutional kernels and is filled in the same way, and outputs a 14×14×32 feature tensor after ReLU activation and 2×2 max pooling; the second convolutional block uses 64 3×3 convolutional kernels and outputs a 7×7×64 feature tensor; the third convolutional block uses 128 3×3 convolutional kernels and outputs a 3×3×128 feature tensor.

8. The method for identifying sensing service devices based on traffic flow images and convolutional neural networks as described in claim 7, characterized in that, The classification module includes a flattening layer, a fully connected layer, a regularization layer with a dropout rate of 0.5, and an output layer. The flattening layer flattens the 3×3×128 three-dimensional feature tensor into a 1152-dimensional one-dimensional feature vector. The hidden layer of the fully connected layer contains 256 neurons and is activated by ReLU. The number of neurons in the output layer is equal to the number of candidate device categories, and the output layer outputs the posterior probability of each category after passing through a softmax normalized exponential function.

9. The method for identifying sensing service devices based on traffic flow images and convolutional neural networks as described in claim 1, characterized in that, In step S4, the Adam optimizer and sparse class cross-entropy loss function are used, the batch size is 64, the number of training rounds is 50, and the test set is used as the validation set.

10. The method for identifying sensing service devices based on traffic flow images and convolutional neural networks as described in claim 1, characterized in that, In step S6, the candidate category with the largest value in the posterior probability is taken as the perception service device category to which the network session to be identified belongs, the perception service device identification result is output, and the perception service device identification result is connected to at least one of access control, anomaly detection, vulnerable asset monitoring or digital forensics.