State detection method and device, electronic equipment, storage medium and vehicle
Patent Information
- Application Number
- CN202611433793.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-09-15
- Publication Date
- 2026-10-20
AI Technical Summary
该方式依赖人工串行操作,不仅单次测试周期长、效率低下,而且对灯光效果的判定缺乏客观量化标准,容易受到个人主观判断和环境光线的影响,导致测试结果可靠性不足
[0018]本公开实施例提供的状态检测方法、装置、电子设备、存储介质及车辆,通过向待检测设备发送功能触发指令,在目标功能的执行过程中,获得所述待检测设备的日志数据和指示灯视频流,从所述日志数据中提取与所述功能触发指令对应的目标事件记录,获得所述目标事件记录对应的事件时间戳。进一步,根据所述事件时间戳,从所述指示灯视频流中定位与所述事件时间戳对应的目标视频帧,根据所述目标视频帧对所述待检测设备的指示灯进行状态检测,得到所述指示灯在所述功能触发指令下的实际状态信息。进而将所述实际状态信息与所述功能触发指令对应的预期状态信息进行比对,生成检测结果。相较于现有技术,本公开实施例通过向待检测设备发送功能触发指令,在执行过程中获得日志数据和指示灯视频流,从日志中提取事件时间戳后定位视频帧,再对指示灯进行状态检测并与预期比对生成检测结果,实现了从功能触发到状态验证的全程自动化,将测试人员从繁琐的手动操作中解放出来,大幅缩短了单次测试周期;同时通过对指示灯状态进行量化分析,消除了主观判断误差,提升了检测结果的客观性和可靠性。
Smart Images

Figure FT_1 
Figure FT_2 
Figure FT_3
Abstract
Description
Technical Field
[0001] This disclosure relates to the field of automated testing technology, and in particular to a condition detection method, apparatus, electronic device, storage medium, and vehicle. Background Technology
[0002] On compact devices with limited screens, such as smart glasses, indicator lights are the most direct non-visual interaction channel between the user and the device. They are used to provide feedback on the device status and function triggers, and are expressed in different colors and flashing patterns.
[0003] In existing methods for detecting indicator light status, testers need to manually execute test case triggering functions, then manually extract timestamps from logs, and then manually replay videos to judge the lighting effect. This method relies on manual serial operation, which is not only time-consuming and inefficient, but also lacks objective quantitative standards for judging lighting effects. It is easily affected by personal subjective judgment and ambient light, resulting in insufficient reliability of test results. Summary of the Invention
[0004] To address the aforementioned technical problems, this disclosure provides a condition detection method, apparatus, electronic device, storage medium, and vehicle.
[0005] In a first aspect, embodiments of this disclosure provide a state detection method, the method comprising: Send a function trigger command to the device under test, the function trigger command being used to trigger the device under test to execute a target function; During the execution of the target function, log data and indicator light video streams of the device under test are obtained; Extract the target event record corresponding to the function trigger instruction from the log data, and obtain the event timestamp corresponding to the target event record; Based on the event timestamp, locate the target video frame corresponding to the event timestamp from the indicator light video stream; The status of the indicator lights of the device to be tested is detected based on the target video frame to obtain the actual status information of the indicator lights under the function trigger command. The actual state information is compared with the expected state information corresponding to the function trigger command to generate a detection result.
[0006] In some embodiments, locating the target video frame corresponding to the event timestamp from the indicator light video stream based on the event timestamp includes: Obtain the timestamp information of each video frame in the indicator light video stream, find the video frame with the smallest time difference from the event timestamp in the timestamp information of each video frame, and determine the found video frame as the target video frame; or, Using the event timestamp as the center time, extract multiple video frames from the indicator light video stream, including the target duration range before and after the center time, and use the multiple video frames as the target video frame.
[0007] In some embodiments, the step of performing state detection on the indicator lights of the device under test based on the target video frame to obtain the actual state information of the indicator lights under the function trigger command includes: For each frame of the target video frame, the region of interest is located, and the target region image where the indicator light is located is extracted. The target region image is converted to the target color space to generate color feature data for each frame of the image. Based on the color feature data, the attribute information of the indicator light in each frame of the image is determined, and the attribute information includes at least one of color information and brightness information; The actual status information of the indicator light is determined based on the temporal changes in the attribute information in each frame of the image.
[0008] In some embodiments, when the indicator light is a white indicator light, determining the attribute information of the indicator light in each frame of the image based on the color feature data includes: The target image region is subjected to layered detection using multi-level brightness thresholds to obtain the detection results for each level; Based on the detection results of each level, generate the corresponding binary mask for each level, and fuse the corresponding binary masks of each level to generate the brightness detection mask. The brightness detection mask is converted to grayscale space for detection to generate a grayscale detection mask. The brightness information of the white indicator light in each frame of the image is obtained by performing mask fusion based on the brightness detection mask and the grayscale detection mask.
[0009] In some embodiments, when the indicator light is a colored indicator light, determining the attribute information of the indicator light in each frame of the image based on the color feature data includes: Obtain the hue range of the color indicator light; In the target color space, hue value detection is performed on the target image region to obtain a hue mask; When the hue mask is within the hue range, it is determined that the color indicator light is on, and the color information of the color indicator light is recorded.
[0010] In some embodiments, extracting the target event record corresponding to the function triggering instruction from the log data includes: Obtain a function-keyword mapping table, wherein the mapping table records at least one function identifier and the log keyword corresponding to the function identifier; Based on the function identifier of the function trigger instruction, the corresponding target log keyword is searched from the mapping table; The log data is scanned to obtain log records that match the target log keyword, and the matched log records are identified as target event records.
[0011] In some embodiments, scanning the log data to obtain log records matching the target log keyword includes: The log data is searched for log records containing the target log keyword using string matching; or, The log records in the log data that match the log pattern corresponding to the target log keyword are found using regular expression matching.
[0012] In some embodiments, obtaining the log data and indicator light video stream of the device under test includes: Using the target time source as the time reference, a first timestamp based on the time reference is added to each log record in the log data to obtain log data with the first timestamp added. A second timestamp based on the time base is added to each frame of the indicator light video stream to obtain an indicator light video stream with the second timestamp added; The first timestamp and the second timestamp are generated based on the target time source so that the log data and the indicator video stream are aligned on the timeline.
[0013] In some embodiments, the actual state information includes at least one of color, brightness, flicker frequency, and duration; the step of comparing the actual state information with the expected state information corresponding to the function trigger instruction to generate a detection result includes: The color of the indicator light is compared with the expected color to obtain the color comparison result; The brightness of the indicator light is compared with the expected brightness to obtain the brightness comparison result; The flashing frequency of the indicator light is compared with the expected frequency to obtain the frequency comparison result; The duration of the indicator light is compared with the expected duration to obtain the duration comparison result; The detection result of the indicator light is generated based on the color comparison result, the brightness comparison result, the frequency comparison result, and the duration comparison result.
[0014] Secondly, embodiments of this disclosure provide a state detection device, the device comprising: The sending module is used to send a function trigger command to the device under test, the function trigger command being used to trigger the device under test to execute a target function; The acquisition module is used to acquire log data and indicator light video streams of the device under test during the execution of the target function; The extraction module is used to extract the target event record corresponding to the function trigger instruction from the log data and obtain the event timestamp corresponding to the target event record; The positioning module is used to locate the target video frame corresponding to the event timestamp from the indicator light video stream based on the event timestamp; The module is used to perform status detection on the indicator lights of the device to be detected based on the target video frame, and obtain the actual status information of the indicator lights under the function trigger command. The detection module is used to compare the actual state information with the expected state information corresponding to the function trigger instruction and generate a detection result.
[0015] Thirdly, embodiments of this disclosure provide an electronic device, including: Memory; Processor; and Computer programs; The computer program is stored in the memory and configured to be executed by the processor to implement the method as described in the first aspect.
[0016] Fourthly, embodiments of this disclosure provide a computer-readable storage medium having a computer program stored thereon, the computer program being executed by a processor to implement the method as described in the first aspect.
[0017] Fifthly, embodiments of this disclosure also provide a computer program product, which includes a computer program or instructions that, when executed by a processor, implement the state detection method described above.
[0018] The state detection method, apparatus, electronic device, storage medium, and vehicle provided in this disclosure send a function trigger command to a device under test. During the execution of a target function, log data and indicator light video streams of the device under test are obtained. A target event record corresponding to the function trigger command is extracted from the log data, and an event timestamp corresponding to the target event record is obtained. Further, based on the event timestamp, a target video frame corresponding to the event timestamp is located from the indicator light video stream. State detection of the indicator lights of the device under test is performed based on the target video frame to obtain the actual state information of the indicator lights under the function trigger command. Then, the actual state information is compared with the expected state information corresponding to the function trigger command to generate a detection result. Compared to existing technologies, the embodiments of this disclosure achieve full automation from function triggering to status verification by sending a function trigger command to the device under test, obtaining log data and indicator light video streams during execution, extracting event timestamps from the logs to locate video frames, and then performing status detection on the indicator lights and comparing them with expectations to generate detection results. This frees testers from tedious manual operations and significantly shortens the single test cycle. At the same time, by quantitatively analyzing the indicator light status, subjective judgment errors are eliminated, improving the objectivity and reliability of the detection results. Attached Figure Description
[0019] The accompanying drawings, which are incorporated in and form a part of this specification, illustrate embodiments consistent with this disclosure and, together with the description, serve to explain the principles of this disclosure.
[0020] To more clearly illustrate the technical solutions in the embodiments of this disclosure or the prior art, the accompanying drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, for those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0021] Figure 1 A flowchart of the state detection method provided in this embodiment of the disclosure; Figure 2 A flowchart of a state detection method provided in another embodiment of this disclosure; Figure 3 A flowchart of a state detection method provided in another embodiment of this disclosure; Figure 4 This is a schematic diagram of the structure of the state detection device provided in the embodiments of this disclosure; Figure 5 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this disclosure. Detailed Implementation
[0022] To better understand the above-mentioned objectives, features, and advantages of this disclosure, the solutions disclosed herein will be further described below. It should be noted that, unless otherwise specified, the embodiments and features described herein can be combined with each other.
[0023] Numerous specific details are set forth in the following description in order to provide a full understanding of this disclosure, but this disclosure may also be implemented in other ways different from those described herein; obviously, the embodiments in the specification are only some, and not all, of the embodiments of this disclosure.
[0024] This disclosure provides a state detection method, which will be described below with reference to specific embodiments.
[0025] Figure 1 This is a flowchart illustrating the state detection method provided in this embodiment. The method can be applied to electronic devices, specifically portable mobile devices such as tablets, laptops, in-vehicle navigation devices, and smart sports equipment; it can also be fixed devices such as personal computers, smart home appliances, and servers. The server can be a single server, a server cluster, a distributed cluster, or a centralized cluster. This method can be applied to scenarios involving state detection of indicator lights. It is understood that the state detection method provided in this embodiment can also be applied to other scenarios.
[0026] The following is about Figure 1 The state detection method shown is described below, and the specific steps of this method are as follows: S101. Send a function trigger command to the device under test, the function trigger command being used to trigger the device under test to execute the target function.
[0027] In this step, the electronic device sends a function trigger command to the device under test (e.g., smart glasses). The function trigger command is used to trigger the device under test to execute a preset target function, such as restarting, starting recording, Bluetooth pairing, restoring factory settings, taking a picture, going into standby mode, being ready for emergency response, or over-the-air updates. The electronic device establishes a stable connection with the device under test via a communication protocol and sends the corresponding function trigger command according to the definition of the test case to initiate the execution of the target function.
[0028] S102. During the execution of the target function, obtain the log data and indicator light video stream of the device under test.
[0029] In this step, while the device under test is performing its target function, the electronic device simultaneously collects two types of data. The first type of data is the system log data of the device under test, which can be captured in real time through the debugging interface. The second type of data is the indicator light video stream, which can be recorded in high definition by deploying an industrial camera to record the indicator light area of the device under test. The electronic device can use a unified and precise time source as a reference clock to ensure precise alignment of the log data and the video stream on the timeline.
[0030] S103. Extract the target event record corresponding to the function trigger instruction from the log data, and obtain the event timestamp corresponding to the target event record.
[0031] In this step, the electronic device intelligently parses the log data to locate the target event record corresponding to the function trigger command. The electronic device searches for matching log records in the log data using a pre-established mapping relationship between functions and log keywords. For example, the log keyword for the factory reset function is "start factory reset," and the electronic device searches the logs for records containing this keyword. Once a target event record is matched, the electronic device extracts the timestamp field from that log record; this timestamp reflects the moment the function was triggered internally within the device.
[0032] S104. Based on the event timestamp, locate the target video frame corresponding to the event timestamp from the indicator light video stream.
[0033] In this step, the electronic device locates the video frame corresponding to the extracted event timestamp in the indicator light video stream. By matching timestamps, the electronic device can find the video frame position corresponding to the function trigger moment in the video stream, thereby establishing a precise mapping between the virtual event in the log and the physical phenomenon in the video.
[0034] S105. Perform status detection on the indicator lights of the device to be detected based on the target video frame to obtain the actual status information of the indicator lights under the function trigger command.
[0035] In this step, the electronic device performs image analysis on the located target video frame to detect the actual state of the indicator light. Using computer vision technology, the electronic device extracts state parameters such as the indicator light's color, brightness, flashing frequency, and duration from the video frame to obtain the actual state information of the indicator light after the function is triggered.
[0036] S106. Compare the actual state information with the expected state information corresponding to the function trigger instruction to generate a detection result.
[0037] In this step, the electronic device compares the actual status information of the detected indicator light with the expected status information defined in the product design specifications. The expected status information predefines the color, flashing pattern, and duration that the indicator light should display after the function is triggered. The electronic device compares the actual status with the expected status item by item, determines whether they match, and generates a detection result containing a pass or fail conclusion. This can be referred to as Example 1.
[0038] This embodiment of the disclosure sends a function trigger command to the device under test. During the execution of the target function, log data and indicator light video streams of the device under test are obtained. A target event record corresponding to the function trigger command is extracted from the log data, and an event timestamp corresponding to the target event record is obtained. Further, based on the event timestamp, a target video frame corresponding to the event timestamp is located from the indicator light video stream. The indicator lights of the device under test are then subjected to state detection based on the target video frame to obtain the actual state information of the indicator lights under the function trigger command. Finally, the actual state information is compared with the expected state information corresponding to the function trigger command to generate a detection result. Compared to existing technologies, the embodiments of this disclosure achieve full automation from function triggering to status verification by sending a function trigger command to the device under test, obtaining log data and indicator light video streams during execution, extracting event timestamps from the logs to locate video frames, and then performing status detection on the indicator lights and comparing them with expectations to generate detection results. This frees testers from tedious manual operations and significantly shortens the single test cycle. At the same time, by quantitatively analyzing the indicator light status, subjective judgment errors are eliminated, improving the objectivity and reliability of the detection results.
[0039] In some embodiments, S106 may include S1061, S1062, S1063, S1064, and S1065: S1061. Compare the color of the indicator light with the expected color to obtain the color comparison result.
[0040] In this step, the electronic device compares the actual color of the detected indicator light with the expected color defined in the product design specifications. The color comparison is based on quantized hue values. If the actual hue value is within the allowable error range of the expected hue, the color comparison result is passed; otherwise, it is failed.
[0041] S1062. Compare the brightness of the indicator light with the expected brightness to obtain the brightness comparison result.
[0042] In this step, the electronic device compares the actual brightness of the detected indicator light with the expected brightness. The brightness comparison is based on a quantized brightness value. If the actual brightness value is within the allowable range of the expected brightness, the brightness comparison result is passed; otherwise, it is failed.
[0043] S1063. Compare the flashing frequency of the indicator light with the expected frequency to obtain the frequency comparison result.
[0044] In this step, the electronic device compares the actual flashing frequency of the detected indicator light with the expected flashing frequency. The flashing frequency is calculated through timing analysis and includes different modes such as fast flashing, slow flashing, and constant light. If the actual flashing frequency matches the expected frequency mode, the frequency comparison result is a pass; otherwise, it is a fail.
[0045] S1064. Compare the duration of the indicator light with the expected duration to obtain the duration comparison result.
[0046] In this step, the electronic device compares the actual duration of the indicator light's illumination with the expected duration. For example, an indicator light triggered by certain functions should remain illuminated for 2 seconds. The electronic device compares the actual duration with the expected duration to determine if it is within the allowable range and generates a duration comparison result.
[0047] S1065. Based on the color comparison result, the brightness comparison result, the frequency comparison result, and the duration comparison result, generate the detection result of the indicator light.
[0048] In this step, the electronic device comprehensively judges the comparison results of each dimension. When the comparison results of all dimensions are passed, a conclusion of detection passed is generated; when the comparison result of any dimension is failed, a conclusion of detection failed is generated, and specific reasons for failure such as color error or frequency mismatch can be output.
[0049] This can be referred to as Example 2. This example achieves comprehensive quantitative verification of the indicator light's status through independent comparison and comprehensive judgment of four dimensions: color, brightness, flashing frequency, and duration. This multi-dimensional comparison mechanism ensures high accuracy and comprehensiveness of the detection results, enabling precise diagnosis of deep-seated interaction problems such as response delays, color errors, and abnormal state switching, fundamentally changing the traditional evaluation mode that relies on human observation and subjective judgment.
[0050] Figure 2 A flowchart of a state detection method provided in another embodiment of this disclosure is shown below. Figure 2 As shown, the method includes the following steps: S201. Using the target time source as the time reference, add a first timestamp based on the time reference to each log record in the log data to obtain log data with the first timestamp added.
[0051] In this step, the electronic device uses the target time source as the reference clock and adds a first timestamp based on this time reference to each log record when collecting system log data. The target time source can be a high-precision clock source or a network time protocol server to ensure the accuracy and consistency of the timestamps. By adding a high-precision timestamp to each log record, each event in the log data has a precise time coordinate.
[0052] S202. Add a second timestamp based on the time base to each frame of the video image in the indicator light video stream to obtain an indicator light video stream with the second timestamp added.
[0053] The first timestamp and the second timestamp are generated based on the target time source so that the log data and the indicator video stream are aligned on the timeline.
[0054] In this step, when the electronic device acquires the indicator light video stream, it also uses the target time source as a reference and adds a second timestamp to each frame of the video image. Since the first timestamp of the log data and the second timestamp of the video frame are generated based on the same time source, they are naturally aligned on the timeline, achieving millisecond-level accuracy. This scheme, which establishes a time mapping relationship at the source of data acquisition, ensures that the event records in the log correspond precisely in time to the phenomena in the video.
[0055] This embodiment establishes a precise time mapping relationship between the device's internal logs and the physical world video stream by simultaneously adding timestamps based on a unified time base to log records and video frames at the data acquisition source, during the acquisition phase. Compared to manual alignment afterward, this solution solves the time synchronization problem between multiple systems, providing a data foundation with strict temporal consistency for subsequent accurate event location and status analysis, achieving millisecond-level time alignment accuracy.
[0056] S203. Obtain a function-keyword mapping table, wherein the mapping table records at least one function identifier and the log keyword corresponding to the function identifier.
[0057] In this step, the electronic device obtains a pre-established mapping table between functions and log keywords. This mapping table records each function identifier and its corresponding log keyword. For example, the factory reset function corresponds to the log keyword "start factory reset", the start recording function corresponds to the log keyword "start recording", and the Bluetooth pairing function corresponds to the log keyword "bluetooth pairing". The mapping table is pre-configured based on the device system log format, ensuring that different functions have clear and identifiable identifiers in the logs.
[0058] S204. Based on the function identifier of the function trigger instruction, search for the corresponding target log keyword in the mapping relationship table.
[0059] In this step, the electronic device searches for the corresponding log keyword in the mapping table based on the function identifier of the function trigger command, and uses it as the target log keyword. For example, if the function trigger command sent is "restore factory settings", then the corresponding target log keyword "start factory reset" is found in the mapping table.
[0060] S205. Scan the log data to obtain log records that match the target log keyword, and identify the matched log records as target event records.
[0061] In this step, the electronic device scans the log data line by line, searching for log records containing the target log keyword. When a record containing the target log keyword is found, it is identified as the target event record, and the timestamp field of that record is extracted. Through keyword matching, the electronic device can quickly and accurately locate the event record related to the function trigger from massive amounts of logs.
[0062] This can be referred to as Example 3. This example establishes a mapping table between functions and keywords, enabling intelligent conversion from unstructured log data to standardized event information. The keyword matching method is simple and efficient, quickly locating target events from massive logs and providing a crucial time-series analysis foundation for the entire detection process.
[0063] In some embodiments, S205 may include at least one of S2051 and S2052: S2051. Use string matching to search for log records in the log data that include the target log keyword; In this method, the electronic device searches the log data line by line, determining whether each log record contains a substring of the target log keyword. If a log record contains a continuous character sequence of the target log keyword, then the line is considered a successful match. This string matching method is simple to implement, fast to execute, and suitable for scenarios with fixed log formats and clearly defined keywords.
[0064] S2052. Use regular expression matching to search for log records in the log data that match the log pattern corresponding to the target log keyword.
[0065] In this approach, the electronic device converts the target log keywords into regular expression patterns and then performs pattern matching on each line of the log data. Regular expressions support wildcards, optional fields, and complex pattern matching, enabling them to adapt to scenarios where log formats may dynamically change. For example, when logs contain dynamically changing fields such as timestamps and thread IDs, regular expressions can flexibly match these fields, improving the robustness of event recognition.
[0066] This embodiment provides two methods—precise string matching and regular expression matching—to flexibly adapt to the parsing needs of different log formats. String matching is simple and efficient, suitable for logs with fixed formats; regular expression matching is highly flexible and suitable for complex scenarios where log formats may change. The two methods can be selected or combined according to actual needs, significantly improving the accuracy and robustness of event identification.
[0067] S206. Obtain the event timestamp corresponding to the target event record.
[0068] Once a target event record is matched, the electronic device extracts the timestamp field from the log record, which reflects the moment when the function was triggered inside the device.
[0069] S207. Based on the event timestamp, locate the target video frame corresponding to the event timestamp from the indicator light video stream.
[0070] Specifically, the implementation process and principle of S207 and S104 are the same, and will not be repeated here.
[0071] S208. Perform status detection on the indicator lights of the device to be detected based on the target video frame to obtain the actual status information of the indicator lights under the function trigger command.
[0072] Specifically, the implementation process and principle of S208 and S105 are the same, and will not be repeated here.
[0073] S209. Compare the actual state information with the expected state information corresponding to the function trigger instruction to generate a detection result.
[0074] Specifically, the implementation process and principle of S209 and S106 are the same, and will not be repeated here.
[0075] This embodiment uses a target time source as a time reference. A first timestamp based on the target time reference is added to each log record in the log data to obtain log data with the first timestamp. A second timestamp based on the target time reference is added to each frame of the indicator light video stream to obtain an indicator light video stream with the second timestamp. Then, a function-keyword mapping table is obtained. Based on the function identifier of the function trigger instruction, the corresponding target log keyword is searched in the mapping table. The log data is scanned to obtain log records matching the target log keyword, and these matched log records are identified as target event records. Further, the event timestamp corresponding to the target event record is obtained. Based on the event timestamp, the target video frame corresponding to the event timestamp is located in the indicator light video stream. The indicator light of the device under test is then subjected to state detection based on the target video frame to obtain the actual state information of the indicator light under the function trigger instruction. Finally, the actual state information is compared with the expected state information corresponding to the function trigger instruction to generate a detection result. This method, through simultaneously adding timestamps based on a unified time base to log records and video frames at the data acquisition source, provides a data foundation with strict temporal consistency for subsequent accurate event location and status analysis, achieving millisecond-level time alignment accuracy. It automates the entire process from function triggering to status verification, shortening the single test cycle; simultaneously, by quantitatively analyzing the indicator light status, it eliminates subjective judgment errors and improves the objectivity and reliability of the detection results.
[0076] Figure 3 A flowchart of a state detection method provided in another embodiment of this disclosure is shown below. Figure 3 As shown, the method includes the following steps: S301. During the execution of the target function, obtain the log data and indicator light video stream of the device under test.
[0077] Specifically, the implementation process and principle of S301 and S102 are the same, and will not be repeated here.
[0078] S302. Extract the target event record corresponding to the function trigger instruction from the log data, and obtain the event timestamp corresponding to the target event record.
[0079] Specifically, the implementation process and principle of S302 and S103 are the same, and will not be repeated here.
[0080] S303. Obtain the timestamp information of each video frame in the indicator light video stream, find the video frame with the smallest time difference from the event timestamp in the timestamp information of each video frame, and determine the found video frame as the target video frame.
[0081] In this method, the electronic device acquires the timestamp information carried by each frame of the indicator light video stream. The video stream is a sequence of images continuously captured at a fixed frame rate, and each frame is marked with a timestamp under a unified time base during acquisition. The electronic device compares the event timestamp with the timestamps of each video frame one by one, calculates the time difference, and finds the video frame with the smallest time difference to the event timestamp. Since this frame is closest to the moment the event occurred on the timeline, it is determined as the target video frame for subsequent indicator light status detection.
[0082] S304. Using the event timestamp as the center time, extract multiple video frames from the indicator light video stream, including the target duration range before and after the center time, and use the multiple video frames as the target video frame.
[0083] In this method, the electronic device does not target a single frame, but rather captures all video frames within a time window centered on the event timestamp. For example, using the event timestamp as the base time, video frames of a first preset duration (e.g., 1 second) are captured forward, and video frames of a second preset duration (e.g., 5 seconds) are captured forward, assembling all captured video frames into the target video frame sequence. This method is suitable for scenarios that require analyzing the state changes of indicator lights, such as detecting state modes like "flash once," "continuous flashing," or "constantly on."
[0084] This can be referred to as Example 4. This example provides two methods: single-frame precise positioning and multi-frame window capture, flexibly adapting to different detection needs. The single-frame positioning method is fast and computationally inefficient, suitable for quickly confirming the state of the indicator light at the moment of function triggering; the multi-frame window capture method is suitable for scenarios that require analyzing the state change process of the indicator light, and can capture dynamic behaviors such as instantaneous flashing and continuous blinking, providing richer timing information for subsequent state detection.
[0085] S305. Locate the region of interest in each frame of the target video frame and extract the target region image where the indicator light is located.
[0086] In this step, the electronic device locates the region of interest (ROI) in each frame of the target video frame. The position of the indicator light in the video frame is usually fixed or varies within a certain range. The electronic device can locate the position of the indicator light in each frame using a preset image template or target detection algorithm, and extract a sub-image containing only the indicator light area as the target region image. By extracting the ROI, background interference is eliminated, allowing subsequent analysis to focus on the indicator light itself.
[0087] S306. Convert the target region image to the target color space to generate color feature data for each frame of the image.
[0088] In this step, the electronic device converts the extracted target area image from the original color space (such as the BGR color space) to the target color space (such as the HSV color space or the HSL color space). The HSV color space represents color as three independent components: hue, saturation, and brightness. Hue directly corresponds to the color type, and brightness corresponds to the degree of lightness or darkness, making it easier to perform color recognition and brightness analysis. After conversion, color feature data for each frame of the image is generated.
[0089] S307. Determine the attribute information of the indicator light in each frame of the image based on the color feature data.
[0090] The attribute information includes at least one of color information and brightness information.
[0091] In this step, the electronic device determines the attribute information of the indicator light in each frame of the image based on the generated color feature data. The attribute information includes at least one of color information (such as red, green, blue, white, etc.) and brightness information. Specifically, for a colored indicator light, the electronic device determines the color by detecting the hue value of pixels in the target area image; for a white indicator light, the electronic device determines whether the indicator light is lit by detecting the brightness value.
[0092] In some embodiments, when the indicator light is a white indicator light, step S307 may include steps A1, A2, A3, and A4: Step A1: Perform layered detection on the target image region using multi-level brightness thresholds to obtain the detection results for each level; In this step, when the indicator light is white, relying solely on color information is insufficient for accurate detection due to the lack of chromaticity information in white. The electronic device employs a brightness-based detection method. Specifically, it uses a three-layer progressive brightness threshold for layered detection: a high-brightness layer with a high threshold range specifically for detecting white indicator lights under strong light conditions; a medium-brightness layer with a medium threshold range for detecting white indicator lights under medium light intensity; and a low-brightness layer with a low threshold range to ensure accurate identification of white indicator lights even in low-light environments. Each layer independently detects the target area image, yielding the detection result for that layer.
[0093] Step A2: Generate a binary mask corresponding to each level based on the detection results of each level, and fuse the binary masks corresponding to each level to generate a brightness detection mask. In this step, the electronic device generates a corresponding binary mask for each layer based on the detection results of each layer. In the binary mask, pixels that meet the brightness conditions of that layer are marked as foreground, and those that do not are marked as background. Then, the binary masks of the three layers are fused by a logical OR operation, meaning that as long as a pixel that meets the conditions is detected at any layer, that position is marked as foreground, ultimately generating a complete brightness detection mask.
[0094] Step A3: Convert the brightness detection mask to grayscale space for detection to generate a grayscale detection mask; In this step, to further improve detection accuracy, the electronic device introduces a grayscale space-assisted detection mechanism. The electronic device converts the target area image into a grayscale image, sets a grayscale threshold, and generates a bright area mask in the grayscale space, which serves as the grayscale detection mask.
[0095] Step A4: Perform mask fusion based on the brightness detection mask and the grayscale detection mask to obtain the brightness information of the white indicator light in each frame of the image.
[0096] In this step, the electronic device fuses the brightness detection mask and the grayscale detection mask to obtain a comprehensive detection result. The fusion method can be a logical AND operation or a logical OR operation, to take advantage of different detection methods. The final detection result contains the brightness information of the white indicator light in each frame of the image, accurately reflecting whether the white indicator light is lit.
[0097] This can be referred to as Example 5. This example addresses the lack of chromaticity information in white indicator lights by designing a scheme combining multi-level brightness threshold layered detection and grayscale space-assisted detection. This effectively solves the problem of inaccurate detection of white indicator lights under ambient light interference. The three-layer progressive brightness threshold ensures comprehensive coverage from strong light to weak light environments, while grayscale space-assisted detection further verifies brightness information. The fusion of these two methods improves the accuracy and robustness of white indicator light detection.
[0098] In some embodiments, when the indicator light is a colored indicator light, step S307 may include steps B1, B2, and B3: Step B1: Obtain the hue range of the color indicator light; In this step, when the indicator light is a colored indicator light, such as red, orange, green, or blue, the electronic device first obtains the hue range corresponding to that colored indicator light. Different colors occupy different angular intervals on the HSV color wheel. For example, red is distributed in two discontinuous regions, 0-10 degrees and 170-179 degrees (spanning across the color wheel), orange is distributed in 10-25 degrees, and green and blue each have their corresponding hue ranges. Based on a pre-configured color parameter table, the electronic device obtains the hue range, saturation threshold, and brightness threshold corresponding to the color of the indicator light currently being detected.
[0099] Step B2: In the target color space, perform hue value detection on the target image region to obtain a hue mask; In this step, the electronic device performs hue value detection on the target region image in the target color space, namely the HSV color space. For each pixel in the image, its hue component is extracted, and it is determined whether the hue value falls within the hue range. Pixels that meet the hue range condition are marked as foreground, and a hue mask is generated.
[0100] Step B3: When the hue mask is within the hue range, determine that the color indicator light is on and record the color information of the color indicator light.
[0101] In this step, the electronic device makes a judgment based on the generated hue mask. When there is a pixel area in the hue mask that meets the hue range condition, the color indicator light is determined to be on, and the currently detected color information is recorded. For cases where the hue, such as the red indicator light, spans discontinuous areas on the hue ring, the electronic device uses a dual-range detection algorithm to establish two hue range masks and perform a logical OR operation to achieve complete color detection coverage.
[0102] This can be referred to as Example 6. This example achieves high-precision identification of indicator lights of different colors through a method based on precise hue segmentation of the target color space. Considering the unique characteristic of red indicator lights being distributed in discontinuous areas on the hue ring, a dual-range detection algorithm is designed. Complete coverage is achieved by establishing two hue range masks and performing a logical OR operation. The hue range expansion strategy enhances the algorithm's adaptability to changes in lighting and color shifts, providing a precise and reliable color recognition foundation for the status analysis of multi-color indicator lights.
[0103] S308. Determine the actual state information of the indicator light based on the temporal changes of the attribute information in each frame of the image.
[0104] In this step, the electronic device arranges the attribute information of each frame of image in chronological order and analyzes its temporal variation patterns to determine the actual state information of the indicator light. The actual state information can include whether the indicator light is on, the color of the light, the brightness variation pattern, the flashing frequency, and the duration of continuous illumination. For example, by tracking the changes in the indicator light's brightness across multiple consecutive frames, it can determine whether the indicator light "flashes once," "flashes continuously," or "remains on," and calculate the flashing frequency and duration.
[0105] This can be referred to as Example 7. This example achieves precise quantitative detection of indicator light status through four steps: region of interest localization, color space conversion, attribute information extraction, and timing analysis. The introduction of the target color space makes color and brightness recognition more accurate and stable, while timing analysis enables the system to identify different flashing patterns and calculate flashing frequency and duration, providing objective and quantitative status parameters for subsequent automatic comparison.
[0106] S309. Compare the actual state information with the expected state information corresponding to the function trigger instruction to generate a detection result.
[0107] Specifically, the implementation process and principle of S309 and S106 are the same, and will not be repeated here.
[0108] This embodiment of the disclosure obtains log data and indicator light video streams of the device under test during the execution of the target function. It extracts target event records corresponding to the function trigger command from the log data and obtains event timestamps corresponding to these target event records. Then, it obtains the timestamp information of each video frame in the indicator light video stream, searches for the video frame with the smallest time difference from the event timestamp, and identifies the found video frame as the target video frame; or, using the event timestamp as the center time, it extracts multiple video frames from the indicator light video stream, including the target duration range before and after the center time, and uses these multiple video frames as the target video frame. Further, it performs region of interest localization on each frame of the target video frame, extracts the target region image where the indicator light is located, converts the target region image to a target color space, generates color feature data for each frame, determines the attribute information of the indicator light in each frame based on the color feature data, and determines the actual state information of the indicator light based on the temporal changes in the attribute information in each frame. Finally, it compares the actual state information with the expected state information corresponding to the function trigger command to generate a detection result. Using this method, the embodiments of this disclosure achieve precise quantitative detection of indicator light status through four steps: region of interest localization, color space conversion, attribute information extraction, and temporal analysis. The introduction of the target color space makes color and brightness recognition more accurate and stable, and temporal analysis enables the system to identify different flashing patterns and calculate flashing frequency and duration, providing objective and quantitative status parameters for subsequent automatic comparison.
[0109] It should be noted that the vehicle control method involved in the above embodiments may include at least one of Embodiment 1, Embodiment 2, Embodiment 3, Embodiment 4, Embodiment 5, Embodiment 6, and Embodiment 7. For example, Embodiment 1 can be implemented as an independent embodiment, Embodiment 1+2 can be implemented as an independent embodiment, Embodiment 1+2+3 can be implemented as an independent embodiment, Embodiment 1+2+3+4 can be implemented as an independent embodiment, Embodiment 1+2+3+4+5 can be implemented as an independent embodiment, Embodiment 1+2+3+4+5+6 can be implemented as an independent embodiment, Embodiment 1+2+3+4+5+6+7 can be implemented as an independent embodiment, Embodiment 1+4 can be implemented as an independent embodiment, Embodiment 1+2+4 can be implemented as an independent embodiment, Embodiment 1+5 can be implemented as an independent embodiment, Embodiment 1+2+5 can be implemented as an independent embodiment, Embodiment 1+4+5 can be implemented as an independent embodiment, and Embodiment 1+2+3+5 can be implemented as an independent embodiment. Examples 1, 5, and 6 can be implemented as independent embodiments, as can examples 1, 2, 5, and 6, as well as examples 1, 4, 5, and 6, and examples 1, 2, 3, 5, and 6, and examples 1, 5, and 7 can be implemented as independent embodiments. These examples are merely illustrative and not exhaustive; further examples will not be provided here.
[0110] Figure 4 This is a schematic diagram of the structure of a state detection device provided in an embodiment of this disclosure. The state detection device can be an electronic device as described in the above embodiments, or it can be a component or assembly within the electronic device. The state detection device provided in this disclosure can execute the processing flow provided in the state detection method embodiments, such as... Figure 4As shown, the state detection device 40 includes: a sending module 41, an acquisition module 42, an extraction module 43, a positioning module 44, a obtaining module 45, and a detection module 46. Specifically, the sending module 41 sends a function trigger command to the device under test, which triggers the device under test to execute a target function; the acquisition module 42 acquires log data and indicator light video streams of the device under test during the execution of the target function; the extraction module 43 extracts a target event record corresponding to the function trigger command from the log data and obtains the event timestamp corresponding to the target event record; the positioning module 44 locates a target video frame corresponding to the event timestamp from the indicator light video stream based on the event timestamp; the obtaining module 45 performs state detection on the indicator lights of the device under test based on the target video frame to obtain the actual state information of the indicator lights under the function trigger command; and the detection module 46 compares the actual state information with the expected state information corresponding to the function trigger command to generate a detection result.
[0111] Optionally, when the positioning module 44 locates the target video frame corresponding to the event timestamp from the indicator video stream based on the event timestamp, it is specifically used to: obtain the timestamp information of each video frame in the indicator video stream, find the video frame with the smallest time difference from the event timestamp in the timestamp information of each video frame, and determine the found video frame as the target video frame; or, take the event timestamp as the center time, extract multiple video frames from the indicator video stream including the target duration range before and after the center time, and take the multiple video frames as the target video frame.
[0112] Optionally, when the obtaining module 45 performs state detection on the indicator light of the device under test based on the target video frame to obtain the actual state information of the indicator light under the function trigger command, it is specifically used to: locate the region of interest in each frame of the target video frame and extract the target region image where the indicator light is located; convert the target region image to the target color space to generate color feature data for each frame image; determine the attribute information of the indicator light in each frame image based on the color feature data, wherein the attribute information includes at least one of color information and brightness information; and determine the actual state information of the indicator light based on the temporal changes of the attribute information in each frame image.
[0113] Optionally, when the indicator light is a white indicator light, the obtaining module 45, when determining the attribute information of the indicator light in each frame of the image based on the color feature data, specifically performs the following: performs layered detection on the target image region using multi-level brightness thresholds to obtain the detection results of each level; generates a binary mask corresponding to each level based on the detection results of each level; fuses the binary masks corresponding to each level to generate a brightness detection mask; converts the brightness detection mask to grayscale space for detection to generate a grayscale detection mask; and performs mask fusion based on the brightness detection mask and the grayscale detection mask to obtain the brightness information of the white indicator light in each frame of the image.
[0114] Optionally, when the indicator light is a colored indicator light, the obtaining module 45, when determining the attribute information of the indicator light in each frame image based on the color feature data, is specifically used to: obtain the hue range of the colored indicator light; perform hue value detection on the target image area in the target color space to obtain a hue mask; when the hue mask is within the hue range, determine that the colored indicator light is in the lit state, and record the color information of the colored indicator light.
[0115] Optionally, when the extraction module 43 extracts the target event record corresponding to the function triggering instruction from the log data, it is specifically used to: obtain a function-keyword mapping table, wherein the mapping table records at least one function identifier and the log keyword corresponding to the function identifier; search for the corresponding target log keyword in the mapping table according to the function identifier of the function triggering instruction; scan the log data to obtain the log record matching the target log keyword, and determine the matched log record as the target event record.
[0116] Optionally, when the extraction module 43 scans the log data to obtain log records that match the target log keyword, it is specifically used to: use string matching to search for log records in the log data that include the target log keyword; or, use regular expression matching to search for log records in the log data that match the log pattern corresponding to the target log keyword.
[0117] Optionally, when the obtaining module 42 obtains the log data and indicator video stream of the device under test, it is specifically used to: use the target time source as a time reference, add a first timestamp based on the time reference to each log record in the log data when collecting the log data; and add a second timestamp based on the time reference to each video image in the indicator video stream when collecting the indicator video stream; wherein the first timestamp and the second timestamp are generated based on the target time source so that the log data and the indicator video stream are aligned on the time axis.
[0118] Optionally, the actual state information includes at least one of color, brightness, flashing frequency, and duration; when the detection module 46 compares the actual state information with the expected state information corresponding to the function trigger command to generate a detection result, it is specifically used to: compare the color of the indicator light with the expected color to obtain a color comparison result; compare the brightness of the indicator light with the expected brightness to obtain a brightness comparison result; compare the flashing frequency of the indicator light with the expected frequency to obtain a frequency comparison result; compare the duration of the indicator light with the expected duration to obtain a duration comparison result; and generate a detection result for the indicator light based on the color comparison result, the brightness comparison result, the frequency comparison result, and the duration comparison result.
[0119] Figure 4 The state detection device shown in the embodiment can be used to execute the technical solution of the above method embodiment. Its implementation principle and technical effect are similar, and will not be described again here.
[0120] Figure 5 This is a schematic diagram of the structure of an electronic device according to an embodiment of this disclosure. See below for details. Figure 5 It shows a schematic diagram of a structure suitable for implementing the electronic device 600 in the embodiments of this disclosure. Figure 5 The electronic device shown is merely an example and should not be construed as limiting the functionality and scope of the embodiments disclosed herein.
[0121] like Figure 5As shown, electronic device 600 may include a processing device (e.g., a central processing unit, a graphics processor, etc.) 601, which can perform various appropriate actions and processes according to a program stored in read-only memory (ROM) 602 or a program loaded from storage device 608 into random access memory (RAM) 603 to implement the state detection method as described in the embodiments of this disclosure. Various programs and data required for the operation of electronic device 600 are also stored in RAM 603. Processing device 601, ROM 602, and RAM 603 are interconnected via bus 604. Input / output (I / O) interface 605 is also connected to bus 604.
[0122] Typically, the following devices can be connected to I / O interface 605: input devices 606 including, for example, touchscreens, touchpads, keyboards, mice, cameras, microphones, accelerometers, gyroscopes, etc.; output devices 607 including, for example, liquid crystal displays (LCDs), speakers, vibrators, etc.; storage devices 608 including, for example, magnetic tapes, hard disks, etc.; and communication devices 609. Communication device 609 allows electronic device 600 to communicate wirelessly or wiredly with other devices to exchange data. Although Figure 5 An electronic device 600 with various devices is shown; however, it should be understood that it is not required to implement or possess all of the devices shown. More or fewer devices may be implemented or possessed alternatively.
[0123] In particular, according to embodiments of this disclosure, the processes described above with reference to the flowcharts can be implemented as computer software programs. For example, embodiments of this disclosure include a computer program product comprising a computer program carried on a non-transitory computer-readable medium, the computer program containing program code for performing the methods shown in the flowcharts, thereby implementing the state detection method as described above. In such embodiments, the computer program can be downloaded and installed from a network via a communication device 609, or installed from a storage device 608, or installed from a ROM 602. When the computer program is executed by the processing device 601, it performs the functions defined in the methods of embodiments of this disclosure.
[0124] It should be noted that the computer-readable medium described in this disclosure can be a computer-readable signal medium or a computer-readable storage medium, or any combination thereof. A computer-readable storage medium can be, for example,—but not limited to—an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples of a computer-readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer disk, a hard disk, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage device, magnetic storage device, or any suitable combination thereof. In this disclosure, a computer-readable storage medium can be any tangible medium containing or storing a program that can be used by or in conjunction with an instruction execution system, apparatus, or device. In this disclosure, a computer-readable signal medium can include a data signal propagated in baseband or as part of a carrier wave, carrying computer-readable program code. Such propagated data signals can take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. A computer-readable signal medium can be any computer-readable medium other than a computer-readable storage medium, which can send, propagate, or transmit a program for use by or in connection with an instruction execution system, apparatus, or device. The program code contained on the computer-readable medium can be transmitted using any suitable medium, including but not limited to: wires, optical fibers, RF (radio frequency), etc., or any suitable combination thereof.
[0125] Additionally, this disclosure also provides a vehicle, including: a memory; a processor; and a computer program; wherein the computer program is stored in the memory and configured to be executed by the processor to implement the state detection method as described above.
[0126] In some implementations, clients and servers can communicate using any currently known or future-developed network protocol such as HTTP (Hypertext Transfer Protocol) and can interconnect with digital data communication (e.g., communication networks) of any form or medium. Examples of communication networks include local area networks (“LANs”), wide area networks (“WANs”), the Internet (e.g., the Internet of Things), and peer-to-peer networks (e.g., ad hoc peer-to-peer networks), as well as any currently known or future-developed networks.
[0127] The aforementioned computer-readable medium may be included in the aforementioned electronic device; or it may exist independently and not assembled into the electronic device.
[0128] The aforementioned computer-readable medium carries one or more programs that, when executed by the electronic device, cause the electronic device to: Send a function trigger command to the device under test, the function trigger command being used to trigger the device under test to execute a target function; During the execution of the target function, log data and indicator light video streams of the device under test are obtained; Extract the target event record corresponding to the function trigger instruction from the log data, and obtain the event timestamp corresponding to the target event record; Based on the event timestamp, locate the target video frame corresponding to the event timestamp from the indicator light video stream; The status of the indicator lights of the device to be tested is detected based on the target video frame to obtain the actual status information of the indicator lights under the function trigger command. The actual state information is compared with the expected state information corresponding to the function trigger command to generate a detection result.
[0129] Optionally, when one or more of the above-described procedures are executed by the electronic device, the electronic device may also execute other steps described in the above embodiments.
[0130] Computer program code for performing the operations of this disclosure can be written in one or more programming languages or a combination thereof, including but not limited to object-oriented programming languages such as Java, Smalltalk, and C++, as well as conventional procedural programming languages such as the "C" language or similar programming languages. The program code can be executed entirely on the user's computer, partially on the user's computer, as a standalone software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving remote computers, the remote computer can be connected to the user's computer via any type of network—including a local area network (LAN) or a wide area network (WAN)—or can be connected to an external computer (e.g., via the Internet using an Internet service provider).
[0131] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of this disclosure. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions indicated in the blocks may occur in a different order than those indicated in the drawings. For example, two consecutively indicated blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in the block diagrams and / or flowcharts, and combinations of blocks in the block diagrams and / or flowcharts, can be implemented using a dedicated hardware-based system that performs the specified function or operation, or using a combination of dedicated hardware and computer instructions.
[0132] The units described in the embodiments of this disclosure can be implemented in software or hardware. The names of the units are not, in some cases, intended to limit the specific unit.
[0133] The functions described above in this document can be performed at least in part by one or more hardware logic components. For example, exemplary types of hardware logic components that can be used, without limitation, include: field-programmable gate arrays (FPGAs), application-specific integrated circuits (ASICs), application-specific standard products (ASSPs), system-on-a-chip (SoCs), complex programmable logic devices (CPLDs), and so on.
[0134] In the context of this disclosure, a machine-readable medium can be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, apparatus, or device. A machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium can be, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination of the foregoing. More specific examples of machine-readable storage media include electrical connections based on one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination of the foregoing.
[0135] The above description is merely a preferred embodiment of this disclosure and an explanation of the technical principles employed. Those skilled in the art should understand that the scope of this disclosure is not limited to technical solutions formed by specific combinations of the above-described technical features, but should also cover other technical solutions formed by arbitrary combinations of the above-described technical features or their equivalents without departing from the above-described concept. For example, technical solutions formed by substituting the above features with (but not limited to) technical features disclosed in this disclosure that have similar functions.
[0136] Furthermore, while the operations are described in a specific order, this should not be construed as requiring these operations to be performed in the specific order shown or in a sequential order. In certain environments, multitasking and parallel processing may be advantageous. Similarly, while several specific implementation details are included in the above discussion, these should not be construed as limiting the scope of this disclosure. Certain features described in the context of individual embodiments may also be implemented in combination in a single embodiment. Conversely, various features described in the context of a single embodiment may also be implemented individually or in any suitable sub-combination in multiple embodiments.
[0137] Although the subject matter has been described using language specific to structural features and / or methodological logic, it should be understood that the subject matter defined in the appended claims is not necessarily limited to the specific features or actions described above. Rather, the specific features and actions described above are merely illustrative examples of implementing the claims.
Claims
1. A state detection method, characterized in that, The method includes: Send a function trigger command to the device under test, the function trigger command being used to trigger the device under test to execute a target function; During the execution of the target function, log data and indicator light video streams of the device under test are obtained; Extract the target event record corresponding to the function trigger instruction from the log data, and obtain the event timestamp corresponding to the target event record; Based on the event timestamp, locate the target video frame corresponding to the event timestamp from the indicator light video stream; The status of the indicator lights of the device to be tested is detected based on the target video frame to obtain the actual status information of the indicator lights under the function trigger command. The actual state information is compared with the expected state information corresponding to the function trigger command to generate a detection result.
2. The method according to claim 1, characterized in that, The step of locating the target video frame corresponding to the event timestamp from the indicator light video stream based on the event timestamp includes: Obtain the timestamp information of each video frame in the indicator light video stream, find the video frame with the smallest time difference from the event timestamp in the timestamp information of each video frame, and determine the found video frame as the target video frame; or, Using the event timestamp as the center time, extract multiple video frames from the indicator light video stream, including the target duration range before and after the center time, and use the multiple video frames as the target video frame.
3. The method according to claim 1, characterized in that, The step of performing status detection on the indicator lights of the device under test based on the target video frame to obtain the actual status information of the indicator lights under the function trigger command includes: For each frame of the target video frame, the region of interest is located, and the target region image where the indicator light is located is extracted. The target region image is converted to the target color space to generate color feature data for each frame of the image. Based on the color feature data, the attribute information of the indicator light in each frame of the image is determined, and the attribute information includes at least one of color information and brightness information; The actual status information of the indicator light is determined based on the temporal changes in the attribute information in each frame of the image.
4. The method according to claim 3, characterized in that, When the indicator light is white, determining the attribute information of the indicator light in each frame of the image based on the color feature data includes: The target image region is subjected to layered detection using multi-level brightness thresholds to obtain the detection results for each level; Based on the detection results of each level, generate the corresponding binary mask for each level, and fuse the corresponding binary masks of each level to generate the brightness detection mask. The brightness detection mask is converted to grayscale space for detection to generate a grayscale detection mask. The brightness information of the white indicator light in each frame of the image is obtained by performing mask fusion based on the brightness detection mask and the grayscale detection mask.
5. The method according to claim 3, characterized in that, When the indicator light is a colored indicator light, determining the attribute information of the indicator light in each frame of the image based on the color feature data includes: Obtain the hue range of the color indicator light; In the target color space, hue value detection is performed on the target image region to obtain a hue mask; When the hue mask is within the hue range, it is determined that the color indicator light is on, and the color information of the color indicator light is recorded.
6. The method according to claim 1, characterized in that, Extracting the target event record corresponding to the function trigger instruction from the log data includes: Obtain a function-keyword mapping table, wherein the mapping table records at least one function identifier and the log keyword corresponding to the function identifier; Based on the function identifier of the function trigger instruction, the corresponding target log keyword is searched from the mapping table; The log data is scanned to obtain log records that match the target log keyword, and the matched log records are identified as target event records.
7. The method according to claim 6, characterized in that, The step of scanning the log data to obtain log records matching the target log keyword includes: The log data is searched for log records containing the target log keyword using string matching; or, The log records in the log data that match the log pattern corresponding to the target log keyword are found using regular expression matching.
8. The method according to claim 1, characterized in that, The process of obtaining the log data and indicator light video stream of the device under test includes: Using the target time source as the time reference, a first timestamp based on the time reference is added to each log record in the log data to obtain log data with the first timestamp added. A second timestamp based on the time base is added to each frame of the indicator light video stream to obtain an indicator light video stream with the second timestamp added; The first timestamp and the second timestamp are generated based on the target time source so that the log data and the indicator video stream are aligned on the timeline.
9. The method according to any one of claims 1-8, characterized in that, The actual state information includes at least one of color, brightness, flashing frequency, and duration; the step of comparing the actual state information with the expected state information corresponding to the function trigger command to generate a detection result includes: The color of the indicator light is compared with the expected color to obtain the color comparison result; The brightness of the indicator light is compared with the expected brightness to obtain the brightness comparison result; The flashing frequency of the indicator light is compared with the expected frequency to obtain the frequency comparison result; The duration of the indicator light is compared with the expected duration to obtain the duration comparison result; The detection result of the indicator light is generated based on the color comparison result, the brightness comparison result, the frequency comparison result, and the duration comparison result.
10. A state detection device, characterized in that, The device includes: The sending module is used to send a function trigger command to the device under test, the function trigger command being used to trigger the device under test to execute a target function; The acquisition module is used to acquire the log data and indicator light video stream of the device under test during the execution of the target function; The extraction module is used to extract the target event record corresponding to the function trigger instruction from the log data and obtain the event timestamp corresponding to the target event record; The positioning module is used to locate the target video frame corresponding to the event timestamp from the indicator light video stream based on the event timestamp; The module is used to perform status detection on the indicator lights of the device to be detected based on the target video frame, and obtain the actual status information of the indicator lights under the function trigger command. The detection module is used to compare the actual state information with the expected state information corresponding to the function trigger instruction and generate a detection result.
11. An electronic device, characterized in that, include: Memory; processor; as well as Computer programs; The computer program is stored in the memory and configured to be executed by the processor to implement the method as described in any one of claims 1-9.
12. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the method as described in any one of claims 1-9.
13. A vehicle, characterized in that, Includes the state detection device as described in claim 10.