# Real-Time Analysis of Youth Emotion Based on Python Language and Smart Sensor Network

Authors: Qilin Yan
Journal: Mobile Information Systems
 (2022)

---

## Abstract

Adolescents’ emotional changes will have a huge impact on themselves; perhaps, they do not understand themselves. However, according to research, many behaviors of adolescents are often accompanied by emotional changes, and the occurrence of these changes will also bring about their unconsciousness. This article first introduces the research background, significance, and development status of smart home sensors and young people’s emotions at home and abroad. This article then gives a detailed introduction to the Python language, intelligent sensor networks, and real-time analysis of youth emotions. In the introduction, it mainly explains the design of the intelligent sensor network system and introduces the system architecture and software and hardware design of the wireless sensor network in detail. In the hardware part, it mainly gives a brief overview of information collection, data transmission, and data processing. In the software part, the embedded software design of three types of network nodes and the control center software design based on Python are given. Finally, the neural network algorithm is used to realize the real-time analysis of young people’s emotions, and the recognition rate of multiple algorithms and the data situation of multiple emotional factors are tested at the same time. The results show that the highest recognition rate of 58.4% can be achieved on the validation set of the HAPPEI database after preprocessing, which is higher than the recognition result obtained by directly training the network using the training set of the HAPPEI database.


---

## Body

## 1. Introduction

With the rapid development of the wireless communication industry, software and hardware technology products are constantly being updated. The convenience of life, the strong touch on the fingers, and the transcendence of thought and understanding are brought about by this renewal. It not only promoted the development of social economy but also gave modern people better inspiration in thinking mode. Smart sensor network technology satisfies the needs of people at present, so smart sensor network technology will be well developed.As a huge group, teenagers have received many attentions from people. However, the emotional changes in adolescent groups are often very large. Therefore, while paying attention to young people, it is particularly important to understand their emotions. How to realize real-time analysis of young people’s emotions has naturally become a topic worthy of people’s thinking.The technical innovations studied in this paper mainly include two aspects: on the one hand, an intelligent wireless sensor network is designed by using embedded technology and wireless network protocol to realize the demand of real-time analysis. On the other hand, the original classic routing layer protocol—LEACH—is improved and then applied to the smart sensor network to balance the energy consumption in the network, so as to realize the more energy-saving and environmentally friendly functions of the smart sensor network. In addition, this time, the combination of Python language and intelligent sensor network technology is used to realize the visualization of data analysis.


## 2. Related Works

Many scholars at home and abroad have provided a large number of references for the research on Python language, smart sensor networks, youth sentiment, and real-time analysis.Yilmaz proposes an experimental object-oriented application programming interface (API) designed to facilitate the programming of custom pre-/postprocessing modules for finite element (FE) developers/researchers. The API is presented in the form of several symbolic objects, among which the very core FE programming operations are abstracted through the use of metaprogramming and high-level Python language functions. This method produces a concise and self-expression data presentation layer, which can be flexibly used to deal with different finite element discretization schemes [1].Dejanovi et al. described textX (a metalanguage, a tool for building domain-specific languages). It is implemented in Python using the Arpeggio PEG (Analytical Expression Grammar) parser library. They describe (grammar) textX from a single language to build the parser and metamodel of the language, and the parser is used to parse the text representation of the model conforming to the metamodel. As a result of the analysis, a Python object graph will be automatically created, and the structure of the object graph will conform to the metamodel defined by the grammar. This approach eliminates the need for developers to manually analyze the parse tree and transform it into other suitable representations. The textX tool is used as a grammar interpreter, and the parser is configured using the grammar at runtime. The textX tool is a free and open-source project provided on GitHub [2].Green and Chen demonstrate the data functionalization in the Python programming language through data from gas chromatography. The programming method of data analysis is designed to be flexible in order to allow students to learn lessons from here and apply them to new systems outside of the experiment and outside the college [3]. Ali and Gibson aim to determine the reasons why young people have suicidal tendencies in posts posted on the suicide prevention forum on the social media platform Tumblr. They filtered the posts for 2 months to find posts related to suicide. They conducted a thematic analysis of a total of 210 posts to determine the reasons for suicide and the meanings related to them. In the analysis, they identified six main causes of suicide: feeling lonely and disconnected from society, experiencing identity shame, failing to meet expectations, helpless, feeling worthless, and mentally unhealthy [4]. Charles et al. gave a comprehensive overview of the communication and computing aspects of 5G network infrastructure and discussed how they can help promote the Kingdom of Saudi Arabia’s advanced smart grid system. In addition, they also discussed the smart grid, the current security issues surrounding smart grid machines to machine information, and solutions that can be used to identify and avoid cyberthreats [5].Bulgarelli describes AGILE real-time analysis (RTA). The key elements of AGILERTA are flexible software architecture, efficient software management workflow, and optimized team management implemented by the AGILE team in more than 20 years of work [6].Kim et al. proposed a noniterative implicit integration method for real-time analysis of multibody systems. Although implicit Euler integrators are widely used in real-time simulations, Kim et al. use HHT-α integrators to improve the accuracy of the solution. They conducted a stability analysis of the HHT-α integrator to determine whether the proposed integrator has absolute stability. They also performed numerical simulations on rigid linear systems representing high-damping systems and high-oscillation systems to evaluate the performance of the proposed integrator. For nonlinear multibody systems, they also evaluated the performance of the proposed integrator using a double pendulum example. Kim et al. compared the traditional HHT-α integrator with the iterative method and the implicit Euler integrator to verify the accuracy and stability characteristics of the proposed integration method [7]. The data of these studies are not comprehensive, and the results of the studies are still open for discussion. Therefore, it cannot be recognized by the public, and thus cannot be popularized and applied.


## 3. Python Language and Intelligent Sensor Network and Real-Time Analysis of Young People’s Emotions

### 3.1. Python Language

Python is a scripting language with interpreted, object-oriented, dynamic semantics, and beautiful syntax, which supports various existing mainstream operating systems. As a scripting language, Python abandons the heavy and complex data types, and its simplicity greatly reduces the code of the program and further simplifies the development work.


#### 3.1.1. Web Crawler

Features of Python language are as follows: simple, easy to learn, easy to read, interpretable and (byte) compiled, object-oriented, extensible and portable, and rich library.Web spider (WebSpider) is a kind of web robot and web spider, which can automatically decompose web page information according to certain rules. There are many open-source crawlers on the Internet today for users to choose from. Common types include Larbin, Nutch, and Heritrix. Open-source crawler is a web browser software that allows users to use open-source crawler software to directly download network resources. They all have their own advantages and disadvantages. For example, Larbin has the advantage of good performance and reliability, but the disadvantage is that it will draw the conclusion that eliminating duplication is wrong; Nutch, Lucence, and Hadoop mix very well, but the disadvantages are not sustainable; Heritrix has a large volume and excellent performance but lacks Chinese support and poor fault tolerance [8, 9].Three ways for Python crawlers to crawl data are as follows:(1)
Capture data based on API interface: API is an application programming interface, which is some predefined functions; the purpose is to provide applications with the ability to facilitate developers to access a set of routines, without writing functions or understanding the internal working mechanism, a window open to others. For their own development, some websites often choose to open some resources to the outside world. The API interface is more convenient to use, and the required information can be easily obtained through an interface without knowing the specific implementation process. The data can be downloaded directly through the API interface, which ensures the integrity of the data format, and the data structure is good. After obtaining the trial permission, it is very convenient to use(2)
Download data based on GUI: GUI (Graphical User Interface) is a graphical user interface, which refers to a more intuitive graphical interface to display visual interface. The GUI has powerful functions, through which the computer and the user interact using graphics, images, etc. Instead of memorizing tons of commands, choose commands, call files, start programs, or perform some other routine task. This method is the easiest to download, occupies less resources, has high reliability, can be configured, and is convenient and quick(3)
Write a crawler program to download data: in addition to the above two ways of downloading data, writing a crawler program can download the massive data information in the web page more efficiently and quickly. Whether it is an open-source crawler or a custom crawler, it can collect most of the public data on the Internet, support regular expression operations, and has a powerful scripting language system as support. High-quality crawlers can accurately collect the required data, integrate the data, and save it into the warehouse. This research uses Python to write crawler to collect data, which is simple and efficient, has robust crawler performance and good stability, and has the characteristics of uninterrupted batch download. The customized crawler is highly targeted, runs the crawler independently, and has great flexibility. The data captured by the crawler is of great significance to the use of subsequent researchBefore the crawler crawls the web page, it is very important to sort the URLs in the URL queue. Choosing the most important web crawling option is a key factor in determining how to rank URLs [10]. The following are two common strategies for collecting data:
(1)
Breadth priority strategyA comprehensive strategy called broad-first search is the best search strategy implemented by crawlers. The search strategy is to crawl at the end of the URL sequence, instead of processing links that directly point to pages that have not been downloaded. The basic idea is to use the first page as the head of the queue, expand the links in the page, wait for sequential downloads, and then extract the download links from these expanded pages. The process of large-scale search is a process that radiates from the inner layer to the outer layer without being trapped inside. The page is very deep and cannot be discharged by itself. Although this strategy is quite mechanical, it works well, because the crawled pages are arranged in order of importance. Therefore, in fact, the broad priority delivery strategy represents the home page hypothesis [11].
(2)
Depth first strategyThe deep search strategy is a commonly used algorithm for crawlers. It retrieves the content of the page from the beginning of the first URL and then retrieves the content by analyzing the next link, following this link, and downloading it once until a search is performed, until the leaf layer can no longer be used. For a very simple data collection strategy, there should be only one node per search so that the target site can fully access it, which solves the serious problem of large search memory usage. It can be clearly called “a road to black,” and the pages on the Internet are the most important [12].Django’s core framework includes ORM (Object Relational Mapping) for interaction between data models and relational databases, a view system for handling requests, a templating system for display, and a regular expression-based URL dispatcher. In addition, it also includes a lightweight stand-alone web server for development and testing and forms serialization and validation systems, a caching framework with several options for caching, and intervening at every stage of request processing. Middleware is a distribution system that allows application components to communicate with each other using predefined signals, a serialization system that can generate or read JSON-represented Django model instances, and a system for extending the capabilities of the template engine. The core component of Django is the Uppearcase layer, which is similar to plugins and handles all requests and responses in Django. Of course, this Middleware needs to be defined in MIDDLEWARE_CLASSES in the settings.py file. Similar plugins in Django include response middleware, request middleware, view middleware, and exception middleware.Python has been widely recognized by the industry as a powerful and easy-to-learn programming language. The following companies are currently using the Python language:(1)
Google uses the Python language to make a website search system(2)
Well-known foreign YouTube uses Python to write some important services(3)
The P2P file sharing system BitTorrent is a Python program(4)
Intel, Cisco, Hewlett-Packard, Seagate, and IBM also use Python for hardware testing(5)
High-tech fields such as NASA and JPL use Python to realize scientific computing tasks, etc.


### 3.2. Smart Sensor Network

#### 3.2.1. Wired Sensor Network

The traditional sensor network is applied to usually adopt the wired way to carry on the data transmission. Wired sensor networks generally consist of wired sensor nodes, control systems, and wired communication modules [13, 14]. After the wired sensor node collects data with its built-in sensor equipment, it provides a data communication drive for the node through the control system and transmits the data to the data center through the communication module to complete the network of the node [15].


#### 3.2.2. Wireless Sensor Network

In order to solve the wiring problem of wired sensor network, the wireless transmission method has been well used. The wireless sensor network generally obtains information according to its small and small intelligent sensor nodes [16–18]. The nodes cooperate with each other in the way of automatic networking, and the network adopts the wireless communication method. Wireless sensor networks have the following advantages:
(1)
It is easy to deploy. Because there is no need to lay the network cable, it can be placed anywhere [19](2)
Efficient data collection and transmission. Because wireless sensor networks usually have the characteristics of network self-organization, wireless sensor nodes are densely deployed. If a node at a monitoring point fails, this part of the task can be completed by other nearby nodes [20](3)
Low cost. Because of the development of wireless sensor technology, the price of a single sensor node is getting lower and lower. In addition, the wireless network saves the large cost of laying the network cable than the wired network [21]Wireless sensor networks are generally composed of wireless sensor nodes, base station nodes, gateway devices, and data centers [22]. The sensor node is responsible for collecting data parameters and sending the data to the base station node after corresponding processing. The base station node is connected to the network conversion equipment, and the data is sent to the data center through the network [23, 24]. The wireless sensor network architecture is shown in Figure 1.Figure 1
Wireless sensor network architecture diagram.Wireless sensor networks have solved many problems in current engineering applications. However, the coverage and communication quality of wireless communication often also affect its large-scale applications. It can increase the distance of wireless communication and improve the quality of data communication by improving the performance of the antenna and optimizing the wireless transmission mechanism [25].


#### 3.2.3. Heterogeneous Sensor Network

According to the introduction and research of wired sensor network and wireless sensor network, it can be seen that a single monitoring technology tends to lose sight of the other. No matter whether it is wired or wireless, there are always some advantages and disadvantages of its own. For this reason, we propose a new type of intelligent sensor network. It combines both wired and wireless monitoring technologies and is a heterogeneous sensor network with multiple forms of communication. The smart sensor network can select the most suitable network communication type according to the specific situation [26, 27].


#### 3.2.4. Topological Structure of Smart Sensor Network

The topology of a heterogeneous sensor network is divided into two parts. The general wired network adopts a centralized structure, all nodes are directly connected to the data center through network cables, and all data is processed by the data center. Wireless sensors can also imitate this structure. All data in this structure is transmitted to the base station node for unified processing, and the traditional centralized algorithm can be easily implemented.A structure of direct data processing of nodes can be considered. We can assume that each smart sensor measures and processes data relatively independently and that no information is shared between neighboring nodes. Since only the processed data is returned to the base station, this makes the communication capability requirements relatively moderate, which can solve the problem of a large number of expanded smart sensors.However, this independent method does not utilize information between neighboring nodes, and all spatial information is discarded. For example, the inability to obtain or use modal shape information and the inability to use spatial information limit the effect of this method. To improve on this basis, a layered network structure can be adopted. It can eliminate the limitations of the above two processing methods.In the system, smart sensors are divided into several layers, and nodes use lower nodes and high-energy upper nodes. Assuming that the upper node has enough energy, it can reduce the transmission speed limit between them, and the lower node has medium energy consumption. The use of high-energy nodes will not weaken the advantages of smart sensors or limit the flexibility of the network. The structural analysis that takes into account the multipoint measurement information also preserves the necessary spatial information. These characteristics enable it to be used in densely arranged sensor networks.


#### 3.2.5. Technical System of Smart Sensor Network

(1)
Information collection technologyThe core of the intelligent sensor network is information collection, and the information collection technology mainly includes two aspects: sensor technology and sensor signal processing technology. The functions of these two parts are realized by the sensor board and the processor board, respectively. The hardware carrier of the information collection technology is composed of these two components—the design of the sensor node is particularly important because it is directly related to the application. Many factors in actual application will affect the accuracy of information collection, and the design needs to be considered from many aspects. Sensor nodes can generally be divided into data acquisition modules (sensor boards), data processing modules (processors), power modules, and data transmission modules. The data acquisition module is used to collect the emotional data of teenagers; the data processing module provides simple processing of the original data, and the wired sensor part and the wireless sensor part use different data processing modules; the power module provides energy for the sensor nodes; the data transmission module is divided into two parts. There are different components, one part is wireless communication based on 802.15.4 protocol, and the other part is wired transmission. The composition of sensor nodes is shown in Figure2.
(2)
Data transmission technologyFigure 2
Block diagram of sensor node composition.Wired sensor networks directly use network cables to physically connect data for data transmission. Therefore, the data processing technology mainly studies the wireless sensor network part. It is mainly developed from the two aspects of the wireless transmission carrier—the performance of the wireless antenna and the network communication protocol for data transmission.(1)
Wireless antennaIn order to meet the actual application requirements, a radio frequency amplifier circuit is added between the antenna and the connector. It achieves the purpose of extending the communication distance by enhancing the transmission power and reducing the insertion loss of the receiving channel.(2)
Network communication protocol(1)
MAC protocolBecause wireless networks have the characteristics of broadcast signals, their transmission quality is far inferior to wired transmission methods. In the wireless network structure, a node transmits data to the outside, and several nodes around it within the effective range will receive it. Conversely, when a node receives data, it may also receive data from different nodes at the same time. These data signals will cause conflicts due to data superposition, resulting in data loss or distortion. The data transmitted by wireless sensors generally includes two types: short messages for control commands and long messages for collecting data. The loss of the former message will cause the node to be unable to start working, while the loss of the latter message will cause the data to be inaccurate and affect subsequent data processing. It can solve this problem from the following two aspects.The first thing to be solved is the problem of channel allocation. It needs to choose an appropriate channel access mechanism to avoid conflicts between data packets. The use of carrier sense media access mechanism (CSMA/CA) can solve the conflict problem very well. When a node needs to send data, first check whether there is data transmission in the channel. If not, send the data directly, and if there is data being transmitted, keep waiting for a random length of time, and check again after the waiting time is over. This is repeated until the channel is in an idle state, and the node can start sending data packets.On the other hand, data loss can be avoided by receiving situation feedback, and the acknowledged ACK mechanism is usually used to achieve this function. It adds a control signal to the data packet, and when the target node receives the relevant data, it returns an acknowledgement message to the sending node to indicate that the data has arrived accurately, otherwise the sending node will continue to send the data packet repeatedly. Obviously, data sending nodes need to wait a long time before the confirmation mechanism arrives, and the same piece of data will be repeatedly transmitted multiple times during this time. In the original algorithm, the node waits for the arrival of an ACK every time it sends a piece of data. Using a group ACK mechanism, the sending node sends multiple copies of data at once and then waits. Through these two methods, the problem of data conflict can be effectively resolved, and the reliability of data transmission can be improved.(2)
Routing protocolTraditional wireless routing protocols all use a single-hop method of point-to-point direct transmission. But under the influence of various factors, the point-to-point single-hop mode can easily cause the undeliverable data. So we study a routing protocol based on AODV to improve this situation. The AODV routing protocol is a multihop transmission method based on the channel on-demand allocation mechanism. The entire node network is static unless there is a need for connection establishment. In multihop communication, all leaf nodes must communicate with base station nodes. These leaf nodes can be divided into two types in terms of function: initial leaf nodes and intermediate nodes. The multihop communication method can effectively increase the communication distance and solve the problem of poor wireless communication or inability to communicate between nodes due to environmental restrictions.(3)
Data processing technologyData processing technology mainly includes two aspects: data synchronization and data aggregation. The data collected by each leaf sensor of the sensor network at the same time arrives at the base station node through transmission. The base station node should ensure that their time is synchronized when receiving this batch of data. Otherwise, the data will be misplaced, and the emotional state of young people will not be well evaluated later, and in serious cases, wrong judgments will occur. The effective data aggregation technology is beneficial to improve the performance of data transmission and ensure the accuracy and credibility of the data.


### 3.3. Adolescent Sentiment Analysis

The methods of sentiment mining and analysis are as follows:(1)
Classification: the principles of classification methods are comprehensiveness, independence, and mutual exclusion. When constructing an emotion database, the first is to classify emotions in real life, as far as possible; to make the results of classification include all possible emotional expressions in real life; and to make each category independent of each other. Second, it is necessary to classify emotions according to the formed emotion classification to form a classification database of emotions(2)
Matching and indexing: when performing emotion recognition of adolescents, it is necessary to match the emotion characteristics with the adolescents through the constructed emotion classification database and other emotional characteristics and then index the identified emotional characteristics(3)
Statistical analysis: to realize the emotional description of young people, it is necessary to perform statistical analysis on the emotional characteristics that have been matched and indexed(4)
Time series analysis: using time series analysis to describe the changes of statistical emotional characteristics over time, it can find the time regularity of young people’s emotional expression(5)
Visualization technology: the application of visualization technology is to more intuitively describe the emotional characteristics that are excavated. Logarithmic emotional data can be expressed in the form of curve graphs, histograms, etc., and attribute data can be expressed in visual forms such as network graphs and multidimensional distribution graphs


## 3.1. Python Language

Python is a scripting language with interpreted, object-oriented, dynamic semantics, and beautiful syntax, which supports various existing mainstream operating systems. As a scripting language, Python abandons the heavy and complex data types, and its simplicity greatly reduces the code of the program and further simplifies the development work.


### 3.1.1. Web Crawler

Features of Python language are as follows: simple, easy to learn, easy to read, interpretable and (byte) compiled, object-oriented, extensible and portable, and rich library.Web spider (WebSpider) is a kind of web robot and web spider, which can automatically decompose web page information according to certain rules. There are many open-source crawlers on the Internet today for users to choose from. Common types include Larbin, Nutch, and Heritrix. Open-source crawler is a web browser software that allows users to use open-source crawler software to directly download network resources. They all have their own advantages and disadvantages. For example, Larbin has the advantage of good performance and reliability, but the disadvantage is that it will draw the conclusion that eliminating duplication is wrong; Nutch, Lucence, and Hadoop mix very well, but the disadvantages are not sustainable; Heritrix has a large volume and excellent performance but lacks Chinese support and poor fault tolerance [8, 9].Three ways for Python crawlers to crawl data are as follows:(1)
Capture data based on API interface: API is an application programming interface, which is some predefined functions; the purpose is to provide applications with the ability to facilitate developers to access a set of routines, without writing functions or understanding the internal working mechanism, a window open to others. For their own development, some websites often choose to open some resources to the outside world. The API interface is more convenient to use, and the required information can be easily obtained through an interface without knowing the specific implementation process. The data can be downloaded directly through the API interface, which ensures the integrity of the data format, and the data structure is good. After obtaining the trial permission, it is very convenient to use(2)
Download data based on GUI: GUI (Graphical User Interface) is a graphical user interface, which refers to a more intuitive graphical interface to display visual interface. The GUI has powerful functions, through which the computer and the user interact using graphics, images, etc. Instead of memorizing tons of commands, choose commands, call files, start programs, or perform some other routine task. This method is the easiest to download, occupies less resources, has high reliability, can be configured, and is convenient and quick(3)
Write a crawler program to download data: in addition to the above two ways of downloading data, writing a crawler program can download the massive data information in the web page more efficiently and quickly. Whether it is an open-source crawler or a custom crawler, it can collect most of the public data on the Internet, support regular expression operations, and has a powerful scripting language system as support. High-quality crawlers can accurately collect the required data, integrate the data, and save it into the warehouse. This research uses Python to write crawler to collect data, which is simple and efficient, has robust crawler performance and good stability, and has the characteristics of uninterrupted batch download. The customized crawler is highly targeted, runs the crawler independently, and has great flexibility. The data captured by the crawler is of great significance to the use of subsequent researchBefore the crawler crawls the web page, it is very important to sort the URLs in the URL queue. Choosing the most important web crawling option is a key factor in determining how to rank URLs [10]. The following are two common strategies for collecting data:
(1)
Breadth priority strategyA comprehensive strategy called broad-first search is the best search strategy implemented by crawlers. The search strategy is to crawl at the end of the URL sequence, instead of processing links that directly point to pages that have not been downloaded. The basic idea is to use the first page as the head of the queue, expand the links in the page, wait for sequential downloads, and then extract the download links from these expanded pages. The process of large-scale search is a process that radiates from the inner layer to the outer layer without being trapped inside. The page is very deep and cannot be discharged by itself. Although this strategy is quite mechanical, it works well, because the crawled pages are arranged in order of importance. Therefore, in fact, the broad priority delivery strategy represents the home page hypothesis [11].
(2)
Depth first strategyThe deep search strategy is a commonly used algorithm for crawlers. It retrieves the content of the page from the beginning of the first URL and then retrieves the content by analyzing the next link, following this link, and downloading it once until a search is performed, until the leaf layer can no longer be used. For a very simple data collection strategy, there should be only one node per search so that the target site can fully access it, which solves the serious problem of large search memory usage. It can be clearly called “a road to black,” and the pages on the Internet are the most important [12].Django’s core framework includes ORM (Object Relational Mapping) for interaction between data models and relational databases, a view system for handling requests, a templating system for display, and a regular expression-based URL dispatcher. In addition, it also includes a lightweight stand-alone web server for development and testing and forms serialization and validation systems, a caching framework with several options for caching, and intervening at every stage of request processing. Middleware is a distribution system that allows application components to communicate with each other using predefined signals, a serialization system that can generate or read JSON-represented Django model instances, and a system for extending the capabilities of the template engine. The core component of Django is the Uppearcase layer, which is similar to plugins and handles all requests and responses in Django. Of course, this Middleware needs to be defined in MIDDLEWARE_CLASSES in the settings.py file. Similar plugins in Django include response middleware, request middleware, view middleware, and exception middleware.Python has been widely recognized by the industry as a powerful and easy-to-learn programming language. The following companies are currently using the Python language:(1)
Google uses the Python language to make a website search system(2)
Well-known foreign YouTube uses Python to write some important services(3)
The P2P file sharing system BitTorrent is a Python program(4)
Intel, Cisco, Hewlett-Packard, Seagate, and IBM also use Python for hardware testing(5)
High-tech fields such as NASA and JPL use Python to realize scientific computing tasks, etc.


## 3.1.1. Web Crawler

Features of Python language are as follows: simple, easy to learn, easy to read, interpretable and (byte) compiled, object-oriented, extensible and portable, and rich library.Web spider (WebSpider) is a kind of web robot and web spider, which can automatically decompose web page information according to certain rules. There are many open-source crawlers on the Internet today for users to choose from. Common types include Larbin, Nutch, and Heritrix. Open-source crawler is a web browser software that allows users to use open-source crawler software to directly download network resources. They all have their own advantages and disadvantages. For example, Larbin has the advantage of good performance and reliability, but the disadvantage is that it will draw the conclusion that eliminating duplication is wrong; Nutch, Lucence, and Hadoop mix very well, but the disadvantages are not sustainable; Heritrix has a large volume and excellent performance but lacks Chinese support and poor fault tolerance [8, 9].Three ways for Python crawlers to crawl data are as follows:(1)
Capture data based on API interface: API is an application programming interface, which is some predefined functions; the purpose is to provide applications with the ability to facilitate developers to access a set of routines, without writing functions or understanding the internal working mechanism, a window open to others. For their own development, some websites often choose to open some resources to the outside world. The API interface is more convenient to use, and the required information can be easily obtained through an interface without knowing the specific implementation process. The data can be downloaded directly through the API interface, which ensures the integrity of the data format, and the data structure is good. After obtaining the trial permission, it is very convenient to use(2)
Download data based on GUI: GUI (Graphical User Interface) is a graphical user interface, which refers to a more intuitive graphical interface to display visual interface. The GUI has powerful functions, through which the computer and the user interact using graphics, images, etc. Instead of memorizing tons of commands, choose commands, call files, start programs, or perform some other routine task. This method is the easiest to download, occupies less resources, has high reliability, can be configured, and is convenient and quick(3)
Write a crawler program to download data: in addition to the above two ways of downloading data, writing a crawler program can download the massive data information in the web page more efficiently and quickly. Whether it is an open-source crawler or a custom crawler, it can collect most of the public data on the Internet, support regular expression operations, and has a powerful scripting language system as support. High-quality crawlers can accurately collect the required data, integrate the data, and save it into the warehouse. This research uses Python to write crawler to collect data, which is simple and efficient, has robust crawler performance and good stability, and has the characteristics of uninterrupted batch download. The customized crawler is highly targeted, runs the crawler independently, and has great flexibility. The data captured by the crawler is of great significance to the use of subsequent researchBefore the crawler crawls the web page, it is very important to sort the URLs in the URL queue. Choosing the most important web crawling option is a key factor in determining how to rank URLs [10]. The following are two common strategies for collecting data:
(1)
Breadth priority strategyA comprehensive strategy called broad-first search is the best search strategy implemented by crawlers. The search strategy is to crawl at the end of the URL sequence, instead of processing links that directly point to pages that have not been downloaded. The basic idea is to use the first page as the head of the queue, expand the links in the page, wait for sequential downloads, and then extract the download links from these expanded pages. The process of large-scale search is a process that radiates from the inner layer to the outer layer without being trapped inside. The page is very deep and cannot be discharged by itself. Although this strategy is quite mechanical, it works well, because the crawled pages are arranged in order of importance. Therefore, in fact, the broad priority delivery strategy represents the home page hypothesis [11].
(2)
Depth first strategyThe deep search strategy is a commonly used algorithm for crawlers. It retrieves the content of the page from the beginning of the first URL and then retrieves the content by analyzing the next link, following this link, and downloading it once until a search is performed, until the leaf layer can no longer be used. For a very simple data collection strategy, there should be only one node per search so that the target site can fully access it, which solves the serious problem of large search memory usage. It can be clearly called “a road to black,” and the pages on the Internet are the most important [12].Django’s core framework includes ORM (Object Relational Mapping) for interaction between data models and relational databases, a view system for handling requests, a templating system for display, and a regular expression-based URL dispatcher. In addition, it also includes a lightweight stand-alone web server for development and testing and forms serialization and validation systems, a caching framework with several options for caching, and intervening at every stage of request processing. Middleware is a distribution system that allows application components to communicate with each other using predefined signals, a serialization system that can generate or read JSON-represented Django model instances, and a system for extending the capabilities of the template engine. The core component of Django is the Uppearcase layer, which is similar to plugins and handles all requests and responses in Django. Of course, this Middleware needs to be defined in MIDDLEWARE_CLASSES in the settings.py file. Similar plugins in Django include response middleware, request middleware, view middleware, and exception middleware.Python has been widely recognized by the industry as a powerful and easy-to-learn programming language. The following companies are currently using the Python language:(1)
Google uses the Python language to make a website search system(2)
Well-known foreign YouTube uses Python to write some important services(3)
The P2P file sharing system BitTorrent is a Python program(4)
Intel, Cisco, Hewlett-Packard, Seagate, and IBM also use Python for hardware testing(5)
High-tech fields such as NASA and JPL use Python to realize scientific computing tasks, etc.


## 3.2. Smart Sensor Network

### 3.2.1. Wired Sensor Network

The traditional sensor network is applied to usually adopt the wired way to carry on the data transmission. Wired sensor networks generally consist of wired sensor nodes, control systems, and wired communication modules [13, 14]. After the wired sensor node collects data with its built-in sensor equipment, it provides a data communication drive for the node through the control system and transmits the data to the data center through the communication module to complete the network of the node [15].


### 3.2.2. Wireless Sensor Network

In order to solve the wiring problem of wired sensor network, the wireless transmission method has been well used. The wireless sensor network generally obtains information according to its small and small intelligent sensor nodes [16–18]. The nodes cooperate with each other in the way of automatic networking, and the network adopts the wireless communication method. Wireless sensor networks have the following advantages:
(1)
It is easy to deploy. Because there is no need to lay the network cable, it can be placed anywhere [19](2)
Efficient data collection and transmission. Because wireless sensor networks usually have the characteristics of network self-organization, wireless sensor nodes are densely deployed. If a node at a monitoring point fails, this part of the task can be completed by other nearby nodes [20](3)
Low cost. Because of the development of wireless sensor technology, the price of a single sensor node is getting lower and lower. In addition, the wireless network saves the large cost of laying the network cable than the wired network [21]Wireless sensor networks are generally composed of wireless sensor nodes, base station nodes, gateway devices, and data centers [22]. The sensor node is responsible for collecting data parameters and sending the data to the base station node after corresponding processing. The base station node is connected to the network conversion equipment, and the data is sent to the data center through the network [23, 24]. The wireless sensor network architecture is shown in Figure 1.Figure 1
Wireless sensor network architecture diagram.Wireless sensor networks have solved many problems in current engineering applications. However, the coverage and communication quality of wireless communication often also affect its large-scale applications. It can increase the distance of wireless communication and improve the quality of data communication by improving the performance of the antenna and optimizing the wireless transmission mechanism [25].


### 3.2.3. Heterogeneous Sensor Network

According to the introduction and research of wired sensor network and wireless sensor network, it can be seen that a single monitoring technology tends to lose sight of the other. No matter whether it is wired or wireless, there are always some advantages and disadvantages of its own. For this reason, we propose a new type of intelligent sensor network. It combines both wired and wireless monitoring technologies and is a heterogeneous sensor network with multiple forms of communication. The smart sensor network can select the most suitable network communication type according to the specific situation [26, 27].


### 3.2.4. Topological Structure of Smart Sensor Network

The topology of a heterogeneous sensor network is divided into two parts. The general wired network adopts a centralized structure, all nodes are directly connected to the data center through network cables, and all data is processed by the data center. Wireless sensors can also imitate this structure. All data in this structure is transmitted to the base station node for unified processing, and the traditional centralized algorithm can be easily implemented.A structure of direct data processing of nodes can be considered. We can assume that each smart sensor measures and processes data relatively independently and that no information is shared between neighboring nodes. Since only the processed data is returned to the base station, this makes the communication capability requirements relatively moderate, which can solve the problem of a large number of expanded smart sensors.However, this independent method does not utilize information between neighboring nodes, and all spatial information is discarded. For example, the inability to obtain or use modal shape information and the inability to use spatial information limit the effect of this method. To improve on this basis, a layered network structure can be adopted. It can eliminate the limitations of the above two processing methods.In the system, smart sensors are divided into several layers, and nodes use lower nodes and high-energy upper nodes. Assuming that the upper node has enough energy, it can reduce the transmission speed limit between them, and the lower node has medium energy consumption. The use of high-energy nodes will not weaken the advantages of smart sensors or limit the flexibility of the network. The structural analysis that takes into account the multipoint measurement information also preserves the necessary spatial information. These characteristics enable it to be used in densely arranged sensor networks.


### 3.2.5. Technical System of Smart Sensor Network

(1)
Information collection technologyThe core of the intelligent sensor network is information collection, and the information collection technology mainly includes two aspects: sensor technology and sensor signal processing technology. The functions of these two parts are realized by the sensor board and the processor board, respectively. The hardware carrier of the information collection technology is composed of these two components—the design of the sensor node is particularly important because it is directly related to the application. Many factors in actual application will affect the accuracy of information collection, and the design needs to be considered from many aspects. Sensor nodes can generally be divided into data acquisition modules (sensor boards), data processing modules (processors), power modules, and data transmission modules. The data acquisition module is used to collect the emotional data of teenagers; the data processing module provides simple processing of the original data, and the wired sensor part and the wireless sensor part use different data processing modules; the power module provides energy for the sensor nodes; the data transmission module is divided into two parts. There are different components, one part is wireless communication based on 802.15.4 protocol, and the other part is wired transmission. The composition of sensor nodes is shown in Figure2.
(2)
Data transmission technologyFigure 2
Block diagram of sensor node composition.Wired sensor networks directly use network cables to physically connect data for data transmission. Therefore, the data processing technology mainly studies the wireless sensor network part. It is mainly developed from the two aspects of the wireless transmission carrier—the performance of the wireless antenna and the network communication protocol for data transmission.(1)
Wireless antennaIn order to meet the actual application requirements, a radio frequency amplifier circuit is added between the antenna and the connector. It achieves the purpose of extending the communication distance by enhancing the transmission power and reducing the insertion loss of the receiving channel.(2)
Network communication protocol(1)
MAC protocolBecause wireless networks have the characteristics of broadcast signals, their transmission quality is far inferior to wired transmission methods. In the wireless network structure, a node transmits data to the outside, and several nodes around it within the effective range will receive it. Conversely, when a node receives data, it may also receive data from different nodes at the same time. These data signals will cause conflicts due to data superposition, resulting in data loss or distortion. The data transmitted by wireless sensors generally includes two types: short messages for control commands and long messages for collecting data. The loss of the former message will cause the node to be unable to start working, while the loss of the latter message will cause the data to be inaccurate and affect subsequent data processing. It can solve this problem from the following two aspects.The first thing to be solved is the problem of channel allocation. It needs to choose an appropriate channel access mechanism to avoid conflicts between data packets. The use of carrier sense media access mechanism (CSMA/CA) can solve the conflict problem very well. When a node needs to send data, first check whether there is data transmission in the channel. If not, send the data directly, and if there is data being transmitted, keep waiting for a random length of time, and check again after the waiting time is over. This is repeated until the channel is in an idle state, and the node can start sending data packets.On the other hand, data loss can be avoided by receiving situation feedback, and the acknowledged ACK mechanism is usually used to achieve this function. It adds a control signal to the data packet, and when the target node receives the relevant data, it returns an acknowledgement message to the sending node to indicate that the data has arrived accurately, otherwise the sending node will continue to send the data packet repeatedly. Obviously, data sending nodes need to wait a long time before the confirmation mechanism arrives, and the same piece of data will be repeatedly transmitted multiple times during this time. In the original algorithm, the node waits for the arrival of an ACK every time it sends a piece of data. Using a group ACK mechanism, the sending node sends multiple copies of data at once and then waits. Through these two methods, the problem of data conflict can be effectively resolved, and the reliability of data transmission can be improved.(2)
Routing protocolTraditional wireless routing protocols all use a single-hop method of point-to-point direct transmission. But under the influence of various factors, the point-to-point single-hop mode can easily cause the undeliverable data. So we study a routing protocol based on AODV to improve this situation. The AODV routing protocol is a multihop transmission method based on the channel on-demand allocation mechanism. The entire node network is static unless there is a need for connection establishment. In multihop communication, all leaf nodes must communicate with base station nodes. These leaf nodes can be divided into two types in terms of function: initial leaf nodes and intermediate nodes. The multihop communication method can effectively increase the communication distance and solve the problem of poor wireless communication or inability to communicate between nodes due to environmental restrictions.(3)
Data processing technologyData processing technology mainly includes two aspects: data synchronization and data aggregation. The data collected by each leaf sensor of the sensor network at the same time arrives at the base station node through transmission. The base station node should ensure that their time is synchronized when receiving this batch of data. Otherwise, the data will be misplaced, and the emotional state of young people will not be well evaluated later, and in serious cases, wrong judgments will occur. The effective data aggregation technology is beneficial to improve the performance of data transmission and ensure the accuracy and credibility of the data.


## 3.2.1. Wired Sensor Network

The traditional sensor network is applied to usually adopt the wired way to carry on the data transmission. Wired sensor networks generally consist of wired sensor nodes, control systems, and wired communication modules [13, 14]. After the wired sensor node collects data with its built-in sensor equipment, it provides a data communication drive for the node through the control system and transmits the data to the data center through the communication module to complete the network of the node [15].


## 3.2.2. Wireless Sensor Network

In order to solve the wiring problem of wired sensor network, the wireless transmission method has been well used. The wireless sensor network generally obtains information according to its small and small intelligent sensor nodes [16–18]. The nodes cooperate with each other in the way of automatic networking, and the network adopts the wireless communication method. Wireless sensor networks have the following advantages:
(1)
It is easy to deploy. Because there is no need to lay the network cable, it can be placed anywhere [19](2)
Efficient data collection and transmission. Because wireless sensor networks usually have the characteristics of network self-organization, wireless sensor nodes are densely deployed. If a node at a monitoring point fails, this part of the task can be completed by other nearby nodes [20](3)
Low cost. Because of the development of wireless sensor technology, the price of a single sensor node is getting lower and lower. In addition, the wireless network saves the large cost of laying the network cable than the wired network [21]Wireless sensor networks are generally composed of wireless sensor nodes, base station nodes, gateway devices, and data centers [22]. The sensor node is responsible for collecting data parameters and sending the data to the base station node after corresponding processing. The base station node is connected to the network conversion equipment, and the data is sent to the data center through the network [23, 24]. The wireless sensor network architecture is shown in Figure 1.Figure 1
Wireless sensor network architecture diagram.Wireless sensor networks have solved many problems in current engineering applications. However, the coverage and communication quality of wireless communication often also affect its large-scale applications. It can increase the distance of wireless communication and improve the quality of data communication by improving the performance of the antenna and optimizing the wireless transmission mechanism [25].


## 3.2.3. Heterogeneous Sensor Network

According to the introduction and research of wired sensor network and wireless sensor network, it can be seen that a single monitoring technology tends to lose sight of the other. No matter whether it is wired or wireless, there are always some advantages and disadvantages of its own. For this reason, we propose a new type of intelligent sensor network. It combines both wired and wireless monitoring technologies and is a heterogeneous sensor network with multiple forms of communication. The smart sensor network can select the most suitable network communication type according to the specific situation [26, 27].


## 3.2.4. Topological Structure of Smart Sensor Network

The topology of a heterogeneous sensor network is divided into two parts. The general wired network adopts a centralized structure, all nodes are directly connected to the data center through network cables, and all data is processed by the data center. Wireless sensors can also imitate this structure. All data in this structure is transmitted to the base station node for unified processing, and the traditional centralized algorithm can be easily implemented.A structure of direct data processing of nodes can be considered. We can assume that each smart sensor measures and processes data relatively independently and that no information is shared between neighboring nodes. Since only the processed data is returned to the base station, this makes the communication capability requirements relatively moderate, which can solve the problem of a large number of expanded smart sensors.However, this independent method does not utilize information between neighboring nodes, and all spatial information is discarded. For example, the inability to obtain or use modal shape information and the inability to use spatial information limit the effect of this method. To improve on this basis, a layered network structure can be adopted. It can eliminate the limitations of the above two processing methods.In the system, smart sensors are divided into several layers, and nodes use lower nodes and high-energy upper nodes. Assuming that the upper node has enough energy, it can reduce the transmission speed limit between them, and the lower node has medium energy consumption. The use of high-energy nodes will not weaken the advantages of smart sensors or limit the flexibility of the network. The structural analysis that takes into account the multipoint measurement information also preserves the necessary spatial information. These characteristics enable it to be used in densely arranged sensor networks.


## 3.2.5. Technical System of Smart Sensor Network

(1)
Information collection technologyThe core of the intelligent sensor network is information collection, and the information collection technology mainly includes two aspects: sensor technology and sensor signal processing technology. The functions of these two parts are realized by the sensor board and the processor board, respectively. The hardware carrier of the information collection technology is composed of these two components—the design of the sensor node is particularly important because it is directly related to the application. Many factors in actual application will affect the accuracy of information collection, and the design needs to be considered from many aspects. Sensor nodes can generally be divided into data acquisition modules (sensor boards), data processing modules (processors), power modules, and data transmission modules. The data acquisition module is used to collect the emotional data of teenagers; the data processing module provides simple processing of the original data, and the wired sensor part and the wireless sensor part use different data processing modules; the power module provides energy for the sensor nodes; the data transmission module is divided into two parts. There are different components, one part is wireless communication based on 802.15.4 protocol, and the other part is wired transmission. The composition of sensor nodes is shown in Figure2.
(2)
Data transmission technologyFigure 2
Block diagram of sensor node composition.Wired sensor networks directly use network cables to physically connect data for data transmission. Therefore, the data processing technology mainly studies the wireless sensor network part. It is mainly developed from the two aspects of the wireless transmission carrier—the performance of the wireless antenna and the network communication protocol for data transmission.(1)
Wireless antennaIn order to meet the actual application requirements, a radio frequency amplifier circuit is added between the antenna and the connector. It achieves the purpose of extending the communication distance by enhancing the transmission power and reducing the insertion loss of the receiving channel.(2)
Network communication protocol(1)
MAC protocolBecause wireless networks have the characteristics of broadcast signals, their transmission quality is far inferior to wired transmission methods. In the wireless network structure, a node transmits data to the outside, and several nodes around it within the effective range will receive it. Conversely, when a node receives data, it may also receive data from different nodes at the same time. These data signals will cause conflicts due to data superposition, resulting in data loss or distortion. The data transmitted by wireless sensors generally includes two types: short messages for control commands and long messages for collecting data. The loss of the former message will cause the node to be unable to start working, while the loss of the latter message will cause the data to be inaccurate and affect subsequent data processing. It can solve this problem from the following two aspects.The first thing to be solved is the problem of channel allocation. It needs to choose an appropriate channel access mechanism to avoid conflicts between data packets. The use of carrier sense media access mechanism (CSMA/CA) can solve the conflict problem very well. When a node needs to send data, first check whether there is data transmission in the channel. If not, send the data directly, and if there is data being transmitted, keep waiting for a random length of time, and check again after the waiting time is over. This is repeated until the channel is in an idle state, and the node can start sending data packets.On the other hand, data loss can be avoided by receiving situation feedback, and the acknowledged ACK mechanism is usually used to achieve this function. It adds a control signal to the data packet, and when the target node receives the relevant data, it returns an acknowledgement message to the sending node to indicate that the data has arrived accurately, otherwise the sending node will continue to send the data packet repeatedly. Obviously, data sending nodes need to wait a long time before the confirmation mechanism arrives, and the same piece of data will be repeatedly transmitted multiple times during this time. In the original algorithm, the node waits for the arrival of an ACK every time it sends a piece of data. Using a group ACK mechanism, the sending node sends multiple copies of data at once and then waits. Through these two methods, the problem of data conflict can be effectively resolved, and the reliability of data transmission can be improved.(2)
Routing protocolTraditional wireless routing protocols all use a single-hop method of point-to-point direct transmission. But under the influence of various factors, the point-to-point single-hop mode can easily cause the undeliverable data. So we study a routing protocol based on AODV to improve this situation. The AODV routing protocol is a multihop transmission method based on the channel on-demand allocation mechanism. The entire node network is static unless there is a need for connection establishment. In multihop communication, all leaf nodes must communicate with base station nodes. These leaf nodes can be divided into two types in terms of function: initial leaf nodes and intermediate nodes. The multihop communication method can effectively increase the communication distance and solve the problem of poor wireless communication or inability to communicate between nodes due to environmental restrictions.(3)
Data processing technologyData processing technology mainly includes two aspects: data synchronization and data aggregation. The data collected by each leaf sensor of the sensor network at the same time arrives at the base station node through transmission. The base station node should ensure that their time is synchronized when receiving this batch of data. Otherwise, the data will be misplaced, and the emotional state of young people will not be well evaluated later, and in serious cases, wrong judgments will occur. The effective data aggregation technology is beneficial to improve the performance of data transmission and ensure the accuracy and credibility of the data.


## 3.3. Adolescent Sentiment Analysis

The methods of sentiment mining and analysis are as follows:(1)
Classification: the principles of classification methods are comprehensiveness, independence, and mutual exclusion. When constructing an emotion database, the first is to classify emotions in real life, as far as possible; to make the results of classification include all possible emotional expressions in real life; and to make each category independent of each other. Second, it is necessary to classify emotions according to the formed emotion classification to form a classification database of emotions(2)
Matching and indexing: when performing emotion recognition of adolescents, it is necessary to match the emotion characteristics with the adolescents through the constructed emotion classification database and other emotional characteristics and then index the identified emotional characteristics(3)
Statistical analysis: to realize the emotional description of young people, it is necessary to perform statistical analysis on the emotional characteristics that have been matched and indexed(4)
Time series analysis: using time series analysis to describe the changes of statistical emotional characteristics over time, it can find the time regularity of young people’s emotional expression(5)
Visualization technology: the application of visualization technology is to more intuitively describe the emotional characteristics that are excavated. Logarithmic emotional data can be expressed in the form of curve graphs, histograms, etc., and attribute data can be expressed in visual forms such as network graphs and multidimensional distribution graphs


## 4. Neural Network

The model structure of the neuron is shown in Figure3:Figure 3
Neuron model.The corresponding formula is(1)σθt=fϕκt=f∑i=1nϕiti+a.Figure4 is the basic model of the multilayer perceptron.Figure 4
Base model of multilayer perceptron.The activation function commonly used in early neural networks is shown in Figure5(a).
(2)ft=11+e−t.Figure 5
Sigmoid activation function and tanh activation function.
(a)(b)The tanh activation function is shown in Figure5(b).
(3)tanht=2sigmoid2t+1.The ReLU activation function is as follows:(4)ReLUt=max0,t.PReLU can be converted to ReLU and Leaky-ReLU by setting a learnable parameterbi:
(5)LReLUt=0.01t,t,t<0,t≥0,(6)PReLUt=bit,t,t<0,t≥0.The update method value of the parameter is as follows:(7)Δbi=εΔbi+η∂η∂bi,where ε represents momentum and η represents learning rate.The LReLU and PReLU functions are shown in Figure6.Figure 6
LReLU and PReLU functions.The quadratic cost function is as follows:(8)ω=12n∑tgt−gt∧2,(9)∂ω∂ϕ=gx−g∧tλ′zt,(10)∂ω∂a=gx−g∧tλ′z.The crossing entropy loss function is as follows:(11)ω=‐1n∑tglng∧+1−gln1−g∧.Let it calculate the gradient of the weight parameter:(12)∂ω∂ϕθ=‐1n∑tgλz−1−g1−λz∂λ∂ϕθ=‐1n∑tgλz−1−g1−λzλ′ztθ=1n∑tλ′ztθλz1−λzλz−g=1n∑ttθλz−g.In the same way, we get(13)∂ω∂a=1n∑tλz−g.The number of featuresT is
(14)T=JKW+1−wJ+12H+1−hK+12.The feature number obtained by a positive (negative) 45-degree angle transformation is(15)T′=JKW+1−cJ+12H+1−cK+12.The integral graph can be expressed as(16)SATμ,ν=∑μ≤μ,ν≤νIμ′,ν′.Another expression is(17)SATμ,ν=SATμ,ν‐1+SATμ‐1,ν+Iμ,ν‐SATμ‐1,ν‐1.Characteristic values of integral graph are as follows:(18)Rectsume=SATμ−1,ν‐1+SATμ+w‐1,ν+h−1‐SATμ‐1,ν+h‐1−SATμ+w‐1,ν‐1.For a rectangular feature with an inclination angle of 45 degrees, the definition of its integral graph is(19)TSATμ,ν=∑μ′≤μ,μ′≤ν−ν′Iμ′,ν′.Using the integral graph to calculate the rectangular feature rotated by 45 degrees,(20)Rectsume=TSATμ+w,ν+w+TSATμ‐h,ν+h‐TSATμ,ν−TSATμ+w‐h,ν+w+h.Common convolutional neural network structures include AlexNet and CaffeNet. Figure7 shows the development history of convolutional neural networks in recent years.Figure 7
The development of convolutional neural network.AlexNet proposes a local response normalization layer to avoid saturation of the activation function. The AlexNet network structure is shown in Table1.Table 1
AlexNet network structure.
LayersPatch size/stride/paddingNumber outputConv111∗11/4/096Relu1Norm1Maxpool13∗3/2/096Conv25∗5/1/2256Relu2Norm2Maxpool23∗3/2/0256Conv33∗3/1/1384Relu3Conv43∗3/1/1384Relu4Conv53∗3/1/1256Relu5Maxpool53∗3/2/0256Fc64096Relu6Drop6Fc74096Relu7Drop7Fc81000CaffeNet is just an application expanded on the basis of AlexNet, and its specific network structure is shown in Table2.Table 2
CaffeNet network structure.
LayersPatch size/stride/paddingNumber outputConv111∗11/4/096Relu1Maxpool13∗3/2/096Norm1Conv25∗5/1/2256Relu2Maxpool23∗3/2/0256Norm2Conv33∗3/1/1384Relu3Conv43∗3/1/1384Relu4Conv53∗3/1/1256Relu5Maxpool53∗3/2/0256Fc64096Relu6Drop6Fc74096Relu7Drop7Fc821This paper constructs a small AlexNet-like network for facial expression recognition of teenagers. The structure is shown in Tables3 and 4.Table 3
Constructed convolutional neural networks with fully connected layers.
LayersOutput sizePatch size/stride/paddingConv132@55∗5511∗11/4Relu1Norm1Maxpool132@27∗273∗3/2Conv264@27∗275∗5/1Relu2Norm2Maxpool264@13∗133∗3/2Conv3128@13∗133∗3/1Relu3Conv4256@13∗133∗3/1Relu4Maxpool4256@6∗63∗3/2Fc5256Relu5Drop5Fc6512Relu6Drop6Fc76Table 4
Constructed convolutional neural networks without fully connected layers.
LayersOutput sizePatch size/stride/paddingConv132@55∗5511∗11/4(BatchNorm)Relu1Norm1Maxpool132@27∗273∗3/2Conv264@27∗275∗5/1(BatchNorm)Relu2Norm2Maxpool264@13∗133∗3/2Conv3128@13∗133∗3/1(BatchNorm)Relu3Conv4256@13∗133∗3/1Relu4Maxpool4256@6∗63∗3/2Conv56@6∗63∗3/1Global Avg.Pooling6This experiment uses the HAPPEI database, and the sample distribution in the HAPPEI data set is shown in Figure8.Figure 8
Sample distribution of the training and validation sets in the HAPPEI database.
(a)(b)It can be seen from Figures8(a) and 8(b) that there are many types of samples of type 2 and type 3, and the difference between adjacent types of type 1 and type 2 and type 3 and type 4 is not big.The result of directly training the network using the HAPPEI data set is shown in Figure9(a). The result of fine-tuning on the constructed neural network is shown in Figure 9(b).Figure 9
Recognition rate results.
(a)(b)It can be seen from Figure9(a) that the network structure of CaffeNet and AlexNet is not much different, and the recognition result of AlexNet is relatively higher. Although the network constructed in this paper has fewer parameters, its effect is improved compared with the first two networks. It can be seen from Figure 9(b) that the highest recognition rate of 58.4% can be achieved on the validation set of the HAPPEI database after preprocessing, which is higher than the recognition result obtained by directly using the training set of the HAPPEI database to train the network.The homogeneity test was performed on the analysis data of adolescent sentiment, and the result is shown in Figure10.Figure 10
Homogeneity test results of adolescent sentiment data analysis.
(a)(b)It can be seen from Figures10(a) and 10(b) that the variation between studies is affected not only by sampling error but also by the error between groups.The difference of the homogeneity test variables is shown in Figure11.Figure 11
Differences in homogeneity test variables.
(a)(b)Figure11(a) is the result of analyzing the emotional differences among adolescents of different genders. The data shows that there are significant differences in emotion among adolescents of different genders. Figure 11(b) is the result of sentiment analysis of adolescent depression. The result shows that adolescent depression is closely related to low mood.


## 5. Discussion

Python has a clear syntax, fewer keywords, and a relatively simple structure, which makes it easy for beginners to get started in a short time. Unlike other languages, there is no imperative notation in Python for accessing blocks of variable definitions and for matching modules, without which Python code is cleaner and easier to read.The deficiencies of the Python language are manifested in the following five aspects: (1) fewer developers. Compared with JavaScript, both at home and abroad, Python has a lot fewer developers, which also hinders its development speed to a certain extent; (2) reference materials are insufficient. A mature development language will have a large number of published books to promote the language. At present, there are few books about Python in China, most of which are entry-level classic translation works. For advanced content, you need to refer to English documents. At the same time, there are few promotion activities of Python; after all, Python has not embarked on the road of commercial productization; (3) its running speed cannot be compared with compiled languages. As a kind of interpreted scripting language, its compilation speed is comparable to Java or even slightly higher, but compared with compiled languages (C, C++), there is still a certain gap. Of course, due to its scalability, the key part can be written in C or C++; (4) the syntax is strict. What makes it intolerable for many people is Python’s sensitivity to whitespace; (5) Python lacks true multiprocessor support.Wireless sensor network technology is an important technology in network technology, and it will play a pivotal role in both current applications and future society. Therefore, it can be seen that the application of the technology in the sensor network to the control of the intelligent sensor network system will also be a new breakthrough direction in technology. The combination of hardware and software can form an overall network. The hardware usually consists of terminal nodes and cluster head nodes. These terminal nodes are placed in the application area in a certain way, are self-organized through a certain protocol, and have the ability to perceive the surrounding environment and slight data processing capabilities. The terminal node establishes a connection with the cluster head node and the general control center deployed in the application area through the wireless communication system and transmits the data it collects to it. If the cluster head node is not in the communication range of the terminal node, other nodes can forward the transmitted information until the information is transmitted to the cluster head node. When forwarding, the forwarding node may perform data fusion on the data to be forwarded. After the cluster head node receives the transmitted data, it can perform some necessary processing on it and then upload the information to the control center of the system through a certain remote transmission channel for information maintenance and unified management. Correspondingly, data information such as control instructions issued by the control center is transmitted in the opposite direction of the above path and finally reaches each terminal node. In general, the wireless sensor network as a whole includes three levels: terminal sensor node network, data relay network, and wide-area control transmission network.The application environment of wireless sensor network is very different from the network under normal conditions. The limitations of wireless sensor networks require low power consumption. The shortening of the wireless communication distance can also save energy and increase the running time of the node. The key to the normal communication of the entire network is the communication protocol. The basic data packet analysis and self-organizing network functions are implemented on the communication protocol level. In this way, the upper application layer does not need to understand the underlying data communication mechanism and only needs to call the interface provided by the corresponding protocol layer. The hierarchical routing protocol mainly applies the idea of dividing and conquering and presents a sense of hierarchy of the network in units of clusters. In each cluster unit, the nodes are divided into two different types, so that the main basis for clustering is the remaining energy of each node and the distance between the node and the head. The main purpose of hierarchical routing is to process and integrate the information monitored by nodes to reduce the amount of information, thereby saving network energy and extending the network life cycle.Based on the role of intelligent sensor network technology to achieve the capture of adolescent emotion, further combined with python language to achieve real-time analysis of adolescent emotion, the experimental results show that this study can meet the demand for real-time analysis of adolescent emotions, and the recognition rate of the constructed network is higher than that of CaffeNet network and AlexNet network.


## 6. Conclusion

Based on the research of current intelligent sensor network technology, combined with the comparative research of wireless sensor network and wired sensor network, this paper proposes a network interconnection scheme that more effectively reduces system energy consumption and saves energy. The contents of this paper completed include researching the background and significance of this paper and confirming that the research focus of this paper is the network interconnection part of the intelligent sensor network. Through analysis and comparison of current existing wireless networking technologies, the key technical difficulties and necessary points in the process of building smart sensor networks are clarified. In addition, the results of combining Python and smart sensor network technology to achieve real-time analysis of adolescent emotions not only provide a new solution to the study of emotion analysis but also provide a good technical reference direction for the future research field. In the design of the system, this paper only realizes the wired connection between the coordinator node and the control center, and the system control can only be realized on the PC side of the host computer. In the future, a WiFi transmission module can be added to the coordinator node, and a mobile APP can be developed to realize the control of the entire smart sensor network on the mobile terminal.



---

*Source: 8635787-2022-04-23.xml*