Intelligent classroom light on-off system and method based on target area detection
Through target area detection technology and hardware control, real-time monitoring of the location and number of people in the classroom and automatic lighting adjustment are realized, which solves the problem that the existing system cannot intelligently sense and automatically adjust, improves management efficiency and energy saving effects, and provides flexible visualization Lighting control and monitoring information display.
Patent Information
- Application Number
- CN202410784938.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-18
- Publication Date
- 2024-09-06
AI Technical Summary
The existing classroom lighting switching system cannot realize intelligent sensing or automatic adjustment, resulting in high energy consumption and poor user experience. It lacks data analysis functions and makes it difficult to make efficient management decisions.
Adopt an intelligent classroom lighting switching system based on target area detection, combined with hardware control and computer vision technology, to detect the location and number of people in the classroom through cameras, automatically adjust the lighting status, achieve accurate detection and positioning in multiple areas, and support real-time video and picture display , optimize the area point selection work, support multi-frame selection and irregular area filling.
It achieves real-time monitoring and control, improves classroom management efficiency and comfort, saves electricity, conforms to the concept of green energy conservation and environmental protection, and provides a variety of display methods to meet user needs.
Smart Images

Figure CN118612918A
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer vision technology, and in particular to a smart classroom light switching system and method based on target area detection. Background Art
[0002] Target region detection is a key technology in the field of computer vision. Its main purpose is to automatically identify and locate objects of interest in an image or video frame. This technology is widely used in many fields such as security monitoring, autonomous driving, medical image analysis, drone navigation, and robotic vision. Target detection is not only about identifying the categories of objects in an image, but also about accurately locating the position of each object, usually by drawing a bounding box around the object. This requires the algorithm to not only distinguish between objects of different categories, but also accurately mark their specific locations in the image. Target region detection technology has brought revolutionary changes to many industries by automatically, in real time, and with high precision identifying and locating targets in images, improving work efficiency and intelligence.
[0003] The classroom lighting on / off system, also often referred to as the smart classroom lighting control system or smart lighting solution, is an advanced system that integrates modern information technology with traditional lighting control, and is designed to provide a more efficient, energy-saving, and comfortable lighting environment for the classroom. It supports individual or centralized control of multiple lights, and can flexibly configure the control area according to the classroom layout.
[0004] However, the existing classroom lighting on-off systems still have the following problems: 1) Many classrooms still rely on traditional wall switches to control lights, which is not only inconvenient but also unable to achieve refined management; 2) There is no integrated intelligent sensing or automatic adjustment system, and the lighting cannot be automatically adjusted according to light changes, the number of people or activity needs in the classroom, resulting in high energy consumption and poor user experience; 3) There is no data analysis function, and managers cannot obtain classroom lighting usage data, such as energy consumption statistics, lamp life prediction, etc., making it difficult to make efficient management decisions. Summary of the invention
[0005] In order to overcome the shortcomings of the prior art, the purpose of the present invention is to provide an intelligent classroom lighting switching system and method based on target area detection. According to the deployment position of the lamp tubes in the classroom, the lighting area is simulated by manual point selection, and the lighting is automatically controlled by hardware control, thereby saving electricity and saving classroom electricity consumption, and contributing new solutions to the new ecology of green, energy-saving and environmentally friendly classroom lighting.
[0006] To achieve the above object, the present invention provides the following solutions:
[0007] A smart classroom light switch system based on target area detection, comprising: a hardware control display system and a VUE+Flask image processing system, wherein the hardware control display system is connected to a camera for communication, and the hardware control display system and the VUE+Flask image processing system are connected to each other for communication;
[0008] The hardware control display system is used to call pictures, process them and display them through the terminal;
[0009] The VUE+Flask image processing system is used to upload and identify images and process the images for display.
[0010] Preferably, the hardware control system includes a front-end Jetson Nano development board, an ESP32 chip, a light display interface, and a back-end Yolo model, and the ESP32 chip and the light display interface are both arranged on the Jetson Nano development board.
[0011] Preferably, the VUE+Flask image processing system includes a front-end image upload module, an image processing and display module, and a back-end Yolo model.
[0012] A method for turning lights on and off in a smart classroom based on target area detection comprises the following steps:
[0013] S1. Detect the target in a specific area through the camera, collect the target data information, and upload the collected data information to the ESP32 chip;
[0014] S2, extracting features from the data information collected in step S1 through the backbone network and algorithm, and then fusing the features to improve the model's ability to express local information;
[0015] S3, using the image mask, based on the original video or image, covering multiple detection areas, dividing the original complete picture into multiple areas, and making judgments on them respectively;
[0016] S4. Automatically select points with the mouse to traverse each designated area and calculate whether the center point of each detection box is within the area. Use vector cross multiplication to determine the position of each coordinate point one by one, and accurately count the number of people in each area.
[0017] Preferably, in step S2, the backbone network is CSPDark-Net53 and the algorithm is YOLOv5.
[0018] Preferably, in step S2, the neck network of the YOLOv5 algorithm is combined with the spatial pyramid to perform feature fusion.
[0019] Preferably, in step S4, the specific steps of automatically selecting a point with a mouse are as follows:
[0020] S41, select points in the image and format them into a NumPy array, and when the mouse clicks on the screen, obtain the pixel value of the mouse relative to the upper left corner of the image in the browser;
[0021] S42, obtaining the original width and height of the image and the width and height displayed in the browser through the DOM element, which are represented as rawWidth, rawHeight and proWidth, proHeight respectively;
[0022] S43, dividing the two to obtain the scaling factor of the image relative to the original size, which are named scaleWidth and scaleHeight respectively;
[0023] S44, the pixel value of the mouse click position relative to the original size can be expressed as x=offsetX*scaleWidth and y=offsetY*scaleHeight;
[0024] S45, storing the above information in a nested array, traversing it after the point selection is completed and saving it as a string in the format of a NumPy array.
[0025] Preferably, in step S41, the pixel values of the mouse relative to the upper left corner of the image in the browser are obtained as offsetX and offsetY respectively.
[0026] Preferably, in step S43, scaleWidth and scaleHeight are defined as follows:
[0027]
[0028] According to the specific embodiments provided by the present invention, the present invention discloses the following technical effects:
[0029] The present invention provides a smart classroom light on / off system and method based on target area detection, which realizes real-time monitoring and control by using computer vision technology, ensures accurate monitoring of the presence and position changes of personnel, and can respond quickly and automatically adjust the light status, thereby improving the management efficiency and comfort of the classroom. The target detection technology is adopted, combined with the image mask and spatial pyramid feature fusion, to achieve accurate detection and positioning of multiple regions. At the same time, the system provides a visual display in two ways, real-time video and picture, which is convenient for users to intuitively understand the activities of personnel and the light status in the classroom. The system optimizes the regional point selection work, supports the simultaneous selection of multiple frames and the filling of irregular areas, meets the variability of the seating area in the classroom, and improves the convenience and flexibility of operation. The system realizes independent control of each light tube by real-time monitoring of the position and number of personnel in the classroom, combined with the deployment of the light tube. In this way, when there are fewer people or no one in a specific area, the redundant lights can be automatically turned off, effectively saving electricity, which is in line with the concept of green energy saving and environmental protection. BRIEF DESCRIPTION OF THE DRAWINGS
[0030] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative labor.
[0031] Figure 1 A control flow diagram of a smart classroom lighting on / off system and method based on target area detection provided by an embodiment of the present invention;
[0032] Figure 2 A schematic diagram of a hardware control display system of a smart classroom lighting on / off system and method based on target area detection provided by an embodiment of the present invention;
[0033] Figure 3 Schematic diagram of a VUE+Flask image processing system for a smart classroom lighting on / off system and method based on target area detection provided by an embodiment of the present invention
[0034] Figure 4 A schematic diagram of the principle of people counting for a smart classroom lighting switching system and method based on target area detection provided in an embodiment of the present invention. DETAILED DESCRIPTION
[0035] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0036] like Figure 1-3 As shown, the purpose of the present invention is to provide a smart classroom lighting switch system based on target area detection, including: a hardware control display system and a VUE+Flask image processing system, the hardware control display system is connected to the camera for communication, and the hardware control display system and the VUE+Flask image processing system are connected to each other for communication;
[0037] The hardware control display system is used to call pictures and process them to display them through the terminal;
[0038] The VUE+Flask image processing system is used to upload and identify images and process them for display.
[0039] The hardware control system includes the front-end JetsonNano development board, ESP32 chip, light display interface and the back-end Yolo model. The ESP32 chip and light display interface are both set on the JetsonNano development board.
[0040] The VUE+Flask image processing system includes a front-end image upload module, an image processing and display module, and a back-end Yolo model.
[0041] A method for turning lights on and off in a smart classroom based on target area detection comprises the following steps:
[0042] S1. Detect the target in a specific area through the camera, collect the target data information, and upload the collected data information to the ESP32 chip;
[0043] S2, extracting features from the data information collected in step S1 through the backbone network and algorithm, and then fusing the features to improve the model's ability to express local information;
[0044] S3, using the image mask, based on the original video or image, covering multiple detection areas, dividing the original complete picture into multiple areas, and making judgments on them respectively;
[0045] S4. Automatically select points with the mouse to traverse each designated area and calculate whether the center point of each detection box is within the area. Use vector cross multiplication to determine the position of each coordinate point one by one, and accurately count the number of people in each area.
[0046] In step S2, the backbone network is CSPDark-Net53 and the algorithm is YOLOv5.
[0047] In step S2, the neck network of the YOLOv5 algorithm is combined with the spatial pyramid for feature fusion.
[0048] In step S4, the specific steps of automatically selecting points with the mouse are as follows:
[0049] S41, select points in the image and format them into a NumPy array, and when the mouse clicks on the screen, obtain the pixel value of the mouse relative to the upper left corner of the image in the browser;
[0050] S42, obtaining the original width and height of the image and the width and height displayed in the browser through the DOM element, which are represented as rawWidth, rawHeight and proWidth, proHeight respectively;
[0051] S43, dividing the two to obtain the scaling factor of the image relative to the original size, which are named scaleWidth and scaleHeight respectively;
[0052] S44, the pixel value of the mouse click position relative to the original size can be expressed as x=offsetX*scaleWidth and y=offsetY*scaleHeight;
[0053] S45, storing the above information in a nested array, traversing it after the point selection is completed and saving it as a string in the format of a NumPy array.
[0054] In step S41, pixel values of the mouse relative to the upper left corner of the image in the browser are obtained as offsetX and offsetY respectively.
[0055] In step S43, scaleWidth and scaleHeight are defined as follows:
[0056]
[0057] Working principle: (1) Target detection is the core of the system. YOLOv5 is used, and its backbone network is CSPDark-Net53. After feature extraction, the neck network is combined with the spatial pyramid for feature fusion to improve the model's ability to express local information. On this basis, improvements are made, using image masks to cover multiple detection areas based on the original video or image, so that the original complete picture is divided into multiple areas, so that they can be judged separately.
[0058] (2) Image masking, which is a method for implementing area demarcation on images or video data. In the system, accurate personnel detection is required for each demarcated area in order to decide whether to turn on the corresponding lights based on the number of people in the area.
[0059] (3) Automatic point selection by mouse, which is to enable personnel to intuitively select and delineate areas on an image by directly selecting points on an image to outline an irregular quadrilateral. Different mouse point selection methods were designed for the two systems, one was implemented in Python in the hardware control display system, and the other was implemented in JS in the VUE+Flask image processing system.
[0060] Because the JS implementation is more complex and more difficult than the Python implementation, the following mainly introduces the JS implementation.
[0061] Select points in the image and format them into a NumPy array. When the mouse clicks on the screen, you can get the pixel value of the mouse relative to the upper left corner of the image in the browser, namely offsetX and offsetY. At the same time, get the original width and height of the image and the width and height displayed in the browser through the DOM element, which are represented as rawWidth, rawHeight and proWidth, proHeight respectively. Divide the two to get the scaling factor of the image relative to the original size, named scaleWidth and scaleHeight respectively. The definitions of scaleWidth and scaleHeight are as follows:
[0062]
[0063] Therefore, the pixel value of the mouse click position relative to the original size can be expressed as x=offsetX*scaleWidth and y=offsetY*scaleHeight. The above information is stored in a nested array, and after the point selection is completed, it is traversed and saved as a string in the format of a NumPy array.
[0064] (4) People counting,Next, the system will traverse each designated area and calculate whether the center point of each detection box is within the area.,For intuitive viewing, it is represented by a black dot. To this end, the vector cross multiplication method is used to determine the position of each coordinate point one by one.,This method can effectively determine whether the coordinate point is inside or outside the quadrilateral area,,thus accurately counting the number of people in each area.
[0065] like Figure 4As shown in the figure, through the above processing, the system will generate a Json format string containing the personnel information of each area. This string will contain key information such as the center point coordinates of each area and the number of people. Finally, the system will use the Socket communication protocol to send this Json string from the server to two clients, one is the Web side, so that the light on and off status and personnel distribution of each area can be displayed in real time on the Web interface. The other is the ESP hardware side to control the lights in real time.
[0066] (5) Compatibility layer design: This part is an intermediate layer designed in the hardware control display system to convert the Socket sent by Jetson Nano into WebSocket, so as to facilitate display on the browser.
[0067] Browser socket intermediate compatibility layer. Use the Vite plug-in to build an intermediate compatibility layer running in Node.js to achieve compatibility with socket communication in Python and ESP 32-S3. After Vite is started, the routing behavior is monitored. When the user visits the "Terminal Display" page, the socket client in Node.js initiates a connection request to the Python server. When the connection is established, a WebSocket server is created and all information received by the socket client is forwarded. When the user clicks on the connection socket server on the page, the browser's native Websocket client connects to the Node.js server to achieve data transmission between the front and back ends.
[0068] (6) Drag and drop comparison display design. This part is the implementation of the image display module in the VUE+Flask image processing system.
[0069] (7) Selection of communication protocol. The Socket protocol was selected for sending and receiving information. After trying the WebSocket protocol, it was found that its asynchronous processing functions were inconvenient to use in model processing. Finally, the Socket protocol was selected for communication. A Socket to WebSocket middle layer was designed separately in the hardware control and display system. Socket has the following advantages.
[0070] Flexibility: Socket communication can establish connections between different computers or devices to achieve cross-network communication. This method is very flexible and can be used in a variety of different network environments.
[0071] Real-time: Socket communication is a real-time communication method that can transmit data and information in real time. This makes Socket communication very useful in scenarios that require fast response and real-time interaction, such as online games, real-time chats, etc.
[0072] Cross-platform: Socket communication is a cross-platform communication method that is not limited by operating systems and hardware. Whether it is under Windows, Linux or other operating systems, Socket communication can be used for data transmission.
[0073] Reliability: Socket communication is based on the TCP / IP protocol and has high reliability. The connection established through the TCP protocol is connection-oriented, and the data transmission is stable and reliable, which can ensure the integrity and sequence of the data.
[0074] Scalability: Socket communication can easily realize the communication between the client and the server, and the communication protocol can be expanded and customized according to the needs to meet the needs of different application scenarios.
[0075] (8) Selection of the main control. In this part, Jetson Nano is used as the main control. Jetson Nano is a small and powerful embedded computer with the following advantages:
[0076] Powerful performance: Jetson Nano is equipped with NVIDIA's GPU, which can provide high-performance computing capabilities and is suitable for tasks such as deep learning, artificial intelligence, and computer vision.
[0077] Low power consumption and high efficiency: Despite its powerful performance, Jetson Nano has low power consumption and is suitable for use in scenarios such as edge devices, embedded systems and drones.
[0078] Rich peripheral interfaces: JetsonNano is equipped with rich peripheral interfaces, including USB, HDMI, GPIO, CSI, etc., which can be easily connected to various external devices and sensors.
[0079] Support for a wide range of development frameworks: Jetson Nano supports a variety of development frameworks, including TensorFlow, PyTorch, Caffe, etc., enabling developers to quickly build and deploy deep learning models.
[0080] Community support and rich resources: Jetson Nano has a large developer community and rich resource library, where you can get technical support, tutorials and sample code to speed up development progress.
[0081] As a small, high-performance embedded computer, Jetson Nano has powerful computing capabilities, low power consumption and high efficiency, rich peripheral interfaces, extensive development framework support, and huge community resources. It is suitable for application scenarios such as classroom personnel detection.
[0082] (9) Lighting sub-control node. ESP32-S3 is a low-power, high-performance Wi-Fi and Bluetooth dual-mode SoC (system-on-chip) launched by Espressif. It has the following advantages:
[0083] Powerful performance: ESP32-S3 is equipped with a high-performance 32-bit RISC-V processor running at up to 240MHz, which can provide stable and efficient computing power.
[0084] Low-power design: ESP32-S3 adopts advanced low-power design, which can achieve energy saving without affecting performance, and is suitable for battery-powered and low-power devices.
[0085] Integrated Wi-Fi and Bluetooth: ESP32-S3 integrates Wi-Fi and Bluetooth dual-mode functions, supports 802.11b / g / n / e / i and Bluetooth 5.0, and can achieve wireless connection and communication. It is widely used in the field of Internet of Things and smart devices.
[0086] Complete peripheral interfaces: ESP32-S3 has a wealth of peripheral interfaces, including SPI, I2C, UART, PWM, etc., which can easily connect various external devices and sensors.
[0087] Improved security performance: ESP32-S3 provides a variety of security features at both the hardware and software levels, including hardware encryption engine, secure boot, secure storage, etc., to ensure the security of devices and data.
[0088] High cost-effectiveness: ESP32-S3 has high cost-effectiveness, superior performance, low power consumption, and rich functions, making it suitable for large-scale applications and cost-sensitive projects.
[0089] As a low-power, high-performance Wi-Fi and Bluetooth dual-mode SoC, ESP32-S3 has the advantages of powerful computing power, low-power design, rich peripheral interfaces, improved security performance and high cost-effectiveness. It is necessary to control the series relays of each lamp in actual scenarios, and to perform remote Wi-Fi connection in actual scenarios to reduce the actual cost of wiring, so ESP32-S3 is a good choice.
[0090] The beneficial effects of the present invention are as follows:
[0091] (1) Energy saving and environmental protection: The present invention can detect different personnel location information and personnel quantity information in real time, thereby controlling each individual lamp tube and realizing independent control logic of multiple lamps.
[0092] (2) Flexible visualization: On the control end of the host computer, the display interface after the manual frame can be displayed in real time, showing a central point of the personnel position. At the same time, the number of personnel in each frame will also be transmitted to the web end, so as to display and simulate the light on and off status at that time in real time.
[0093] (3) Convenient interaction: In order to ensure the convenient operation of the entire system, the area selection work of the entire software has been optimized. It can select multiple boxes and draw irregular quadrilaterals to fill them at the same time, meeting the variability of irregular seating areas and personnel as areas in the classroom.
[0094] (4) Real-time monitoring and control: Computer vision technology is used to monitor the location and number of people in the classroom in real time. With the help of the camera to send back videos or pictures, the host computer can forward the detection information to the control terminal and web display terminal. The target detection algorithm is used to identify and locate people in the classroom to ensure accurate monitoring of the presence and position changes of people.
[0095] (5) Multi-faceted display: The system provides a variety of display methods on both the host computer and the Web end, including real-time display of personnel location information, light on / off status, and processing and display of uploaded images, meeting users' diverse needs for lighting control and monitoring information.
[0096] In this specification, each embodiment is described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the embodiments can be referred to each other. For the system disclosed in the embodiment, since it corresponds to the method disclosed in the embodiment, the description is relatively simple, and the relevant parts can be referred to the method part.
[0097] The principles and implementation methods of the present invention are described in this article using specific examples. The description of the above embodiments is only used to help understand the method and core idea of the present invention. At the same time, for those skilled in the art, according to the idea of the present invention, there will be changes in the specific implementation methods and application scope. In summary, the content of this specification should not be understood as limiting the present invention.
Claims
1. A smart classroom lighting on / off system based on target area detection, characterized in that: include: A hardware control display system and a VUE+Flask image processing system, wherein the hardware control display system is communicatively connected to a camera, and the hardware control display system and the VUE+Flask image processing system are communicatively connected to each other; The hardware control display system is used to call pictures, process them and display them through the terminal; The VUE+Flask image processing system is used to upload and identify images and process the images for display.
2. According to the target area detection-based intelligent classroom lighting on / off system of claim 1, it is characterized in that: The hardware control system includes a front-end Jetson Nano development board, an ESP32 chip, a light display interface, and a back-end Yolo model, wherein the ESP32 chip and the light display interface are both arranged on the Jetson Nano development board.
3. According to the target area detection-based intelligent classroom lighting on / off system of claim 1, it is characterized in that: The VUE+Flask image processing system includes a front-end image upload module, an image processing and display module, and a back-end Yolo model.
4. A method for turning on and off lights in a smart classroom based on target area detection according to any one of claims 1 to 3, characterized in that: The following steps are involved: S1. Detect the target in a specific area through the camera, collect the target data information, and upload the collected data information to the ESP32 chip; S2, extracting features from the data information collected in step S1 through the backbone network and algorithm, and then fusing the features to improve the model's ability to express local information; S3, using the image mask, based on the original video or image, covering multiple detection areas, dividing the original complete picture into multiple areas, and making judgments on them respectively; S4. Automatically select points with the mouse to traverse each designated area and calculate whether the center point of each detection box is within the area. Use vector cross multiplication to determine the position of each coordinate point one by one, and accurately count the number of people in each area.
5. According to the method of turning on and off lights in smart classrooms based on target area detection according to claim 4, it is characterized in that: In step S2, the backbone network is CSPDark-Net53 and the algorithm is YOLOv5.
6. According to the method of turning on and off lights in a smart classroom based on target area detection in claim 4, it is characterized in that: In step S2, the neck network of the YOLOv5 algorithm is combined with the spatial pyramid for feature fusion.
7. According to claim 4, a method for turning on and off lights in a smart classroom based on target area detection is characterized in that: In step S4, the specific steps of automatically selecting points with the mouse are as follows: S41, select points in the image and format them into a NumPy array, and when the mouse clicks on the screen, obtain the pixel value of the mouse relative to the upper left corner of the image in the browser; S42, obtaining the original width and height of the image and the width and height displayed in the browser through the DOM element, which are represented as rawWidth, rawHeight and proWidth, proHeight respectively; S43, dividing the two to obtain the scaling factor of the image relative to the original size, which are named scaleWidth and scaleHeight respectively; S44, the pixel value of the mouse click position relative to the original size can be expressed as x=offsetX*scaleWidth and y=offsetY*scaleHeight; S45, storing the above information in a nested array, traversing it after the point selection is completed and saving it as a string in the format of a NumPy array.
8. The method for turning lights on and off in a smart classroom based on target area detection according to claim 7 is characterized in that: In step S41, pixel values of the mouse relative to the upper left corner of the image in the browser are obtained as offsetX and offsetY respectively.
9. The method for turning on and off lights in a smart classroom based on target area detection according to claim 7 is characterized in that: In step S43, scaleWidth and scaleHeight are defined as follows:
