Cloud-based clinical trial data acquisition system
By constructing a co-occurrence matrix to dynamically determine whether the target grayscale string should be added to the dictionary, the problem of LZW encoding compression efficiency depending on dictionary length is solved, and efficient transmission and storage of face videos are achieved.
Patent Information
- Application Number
- CN202510941779.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-07-09
- Publication Date
- 2025-10-31
- Estimated Expiration
- 2045-07-09
AI Technical Summary
The compression efficiency of traditional LZW encoding is highly dependent on the dictionary length, resulting in low efficiency of remote photoplethysmography (LPP) technology for face video transmission and storage in multi-center, large-scale clinical trials.
By constructing a co-occurrence matrix of the encoded sequence, it is dynamically determined whether to add the target grayscale string to the dictionary, thereby shortening the dictionary length and improving compression efficiency.
This reduces the amount of compressed data and improves the transmission and storage efficiency of facial videos.
Smart Images

Figure CN120452644B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of image communication technology. More specifically, this invention relates to a cloud-based clinical trial data acquisition system. Background Technology
[0002] In traditional clinical trial data collection, obtaining key physiological parameters such as heart rate usually requires subjects to travel to medical institutions in person to have them measured using specialized equipment such as electrocardiographs and pulse oximeters. This approach not only increases the time and financial burden on subjects, but also poses a significant obstacle, especially for patients with limited mobility or living in remote areas. Furthermore, it makes continuous monitoring difficult, potentially leading to the omission of important physiological trends.
[0003] The emergence of remote photoplethysmography (rPPG) technology has provided a new method for clinical trial data collection. This technology captures subtle changes in blood flow on the surface of the subject's facial skin using a regular camera, allowing for the extraction of physiological parameters such as heart rate and respiratory rate without physical contact.
[0004] However, rPPG technology relies on high-definition video as a data source. The amount of uncompressed video data is very large. In multi-center, large-scale clinical trials, the video data accumulates at an extremely fast rate, which places extremely high demands on network bandwidth and cloud storage.
[0005] LZW encoding is a dictionary-based compression method used to compress facial videos of subjects. During compression, LZW dynamically constructs a dictionary, adding the shortest substring that first appears in the encoded sequence. This allows subsequent occurrences of the substring to be encoded using its dictionary index, thus achieving compression. However, the compression efficiency of LZW encoding is highly dependent on the dictionary length; longer dictionaries result in poorer compression, impacting the transmission and storage efficiency of the subject's facial video. Summary of the Invention
[0006] To address the technical problem that the compression efficiency of LZW encoding is highly dependent on dictionary length, affecting the transmission and storage efficiency of subject facial videos, this invention provides a cloud-based clinical trial data acquisition system, which includes the following modules:
[0007] The acquisition module acquires facial videos of the subjects; the compression module performs the following steps: S1: Expands the channel data of each image frame of the facial video into an encoding sequence; S2: Constructs the co-occurrence matrix of the encoding sequence and an initial dictionary; S3: Matches the encoding sequence with the elements in the dictionary in descending order of element length to obtain the encoding object, and uses the index of the element matching the encoding object in the dictionary as the encoding result of the encoding object; the encoding object and the next grayscale value in the encoding sequence are used to form a target grayscale string, and the target grayscale string is then compressed based on the length of each substring of length 2. The difference between the frequency of occurrence of the encoded grayscale values and the corresponding elements of each substring of length 2 in the co-occurrence matrix determines whether to add the target grayscale string to the end of the dictionary; S4: Repeat S3 until all grayscale values in the encoding sequence have been encoded and the iteration stops; S5: Concatenate the binary numbers corresponding to all the encoded results to obtain compressed data; Transmission module: Upload the compressed data to the cloud platform; Decompression module: Decompress the compressed data and restore the face video based on the decompression result; Heart rate data extraction module: Extract the subject's heart rate curve based on the face video.
[0008] This invention converts any channel of each image frame in a face video into an encoded sequence for compression. By constructing a co-occurrence matrix of the encoded sequence, it stores the number of times any combination of gray values formed by two gray values appears in the encoded sequence. When compressing the encoded sequence, it dynamically determines whether to add the target gray string to the dictionary based on the difference between the number of times the encoded gray values of the substring of length 2 in the target gray string appear and the corresponding number in the co-occurrence matrix. This ensures that gray values that have not yet been encoded in the encoded sequence can be successfully encoded using gray strings in the dictionary, while also shortening the length of the dictionary, thus reducing the amount of data in the final compressed data and improving the transmission efficiency of face videos.
[0009] Preferably, the step of unfolding the channel data of each image frame of the face video into an encoding sequence includes: treating each channel data of any image frame in the face video as an independent image to be compressed, and unfolding the gray values of the pixels in the image to be compressed into a one-dimensional sequence in the order of S-shaped scanning, as the encoding sequence.
[0010] Preferably, constructing the co-occurrence matrix of the encoded sequence includes: constructing a An empty matrix of size, where This represents the number of grayscale value types appearing in the encoded sequence. Each grayscale value appearing in the encoded sequence is used as a row index and a column index of the matrix. A grayscale value combination is formed by combining the grayscale value corresponding to any row index and the grayscale value corresponding to any column index. The number of times this grayscale value combination appears in the encoded sequence is counted. The corresponding position in the matrix is located using the row index and column index, and the counted number is filled into that position. The final matrix is used as the co-occurrence matrix of the encoded sequence.
[0011] This invention constructs a co-occurrence matrix to store the occurrence pattern of gray value combinations formed by any two gray values in the encoded sequence. This allows the system to dynamically determine whether to add the target gray string to the dictionary based on the occurrence pattern stored in the co-occurrence matrix during the compression process, thereby shortening the dictionary length and improving compression efficiency.
[0012] Preferably, the method for constructing the initial dictionary includes: adding each grayscale value appearing in the encoding sequence to an empty dictionary in ascending order, as the initial dictionary.
[0013] Preferably, the step of matching the encoded sequence with the elements in the dictionary in descending order of element length to obtain the encoded object includes: obtaining the length of the longest element in the dictionary, denoted as D; using the D unencoded grayscale values in the encoded sequence as a grayscale string of length D as the judgment object; matching the elements in the dictionary with the judgment object; in response to the absence of an element in the dictionary that is the same as the judgment object, removing the grayscale value at the end of the judgment object and using the resulting grayscale string as the new judgment object; and in response to the presence of an element in the dictionary that is the same as the judgment object, using the judgment object as the encoded object.
[0014] Preferably, the step of deciding whether to add the target grayscale string to the end of the dictionary includes: obtaining all substrings of length 2 in the target grayscale string, taking the last substring as the first target grayscale value combination, and taking the remaining substrings as second target grayscale value combinations respectively; for any target grayscale value combination, taking the element corresponding to the target grayscale value combination in the co-occurrence dictionary as the target frequency of the target grayscale value combination, obtaining the frequency of the target grayscale value combination in the encoded sequence as the frequency of occurrence of the target grayscale value combination; in response to the fact that the frequency of occurrence of the first target grayscale value combination plus one is less than the target frequency, and the frequency of occurrence of all second target grayscale value combinations is less than the target frequency, adding the target grayscale string to the end of the dictionary.
[0015] This invention determines whether a target grayscale value combination will reappear in the subsequent encoding process by comparing the number of times the target grayscale value combination has appeared with the target number of times. When any target grayscale value combination will not reappear, the target grayscale string containing the target grayscale value combination will also not reappear. Therefore, this invention dynamically decides whether to add the target grayscale string to the dictionary based on the number of times the target grayscale value combination has appeared and the target number of times. This ensures that grayscale values that have not yet been encoded in the encoding sequence can be successfully encoded using grayscale strings in the dictionary, while also shortening the length of the dictionary.
[0016] Preferably, the compression module further includes: in response to the occurrence count of the first target grayscale value combination plus one equaling the target count, treating the first target grayscale value combination as a grayscale value combination to be eliminated; in response to the occurrence count of any second target grayscale value combination equaling the target count, treating the second target grayscale value combination as a grayscale value combination to be eliminated; and removing all elements in the dictionary that contain grayscale value combinations to be eliminated from the dictionary.
[0017] When the target grayscale value combination will not appear again, the element in the dictionary containing the target grayscale value combination will not appear again in the encoding sequence. Therefore, this invention dynamically determines whether to delete the element containing the target grayscale value combination from the dictionary based on the number of times the target grayscale value combination has appeared and the target number of times. This further shortens the length of the dictionary without affecting the encoding of grayscale values in the encoding sequence.
[0018] Preferably, the compression module further includes: in response to appending the target grayscale string to the end of the dictionary, recording the length of the encoded object as... , the dictionary with a length not less than , and before Take all elements with a grayscale value of _th as the encoded object, and treat each as a target element; for any target element, take the _th grayscale value of _th element as the target element. One gray value is used as the gray value to be judged; the last gray value in the encoded object is used as the index gray value, and the number of non-zero elements in the row with the index gray value in the co-occurrence matrix is obtained, denoted by W; in response to the number of gray values to be judged being equal to W, the elements that match the encoded object in the dictionary are removed from the dictionary.
[0019] This invention further shortens the dictionary length by judging the number of grayscale value categories and dynamically removing elements that match the encoded object in the dictionary. The invention matches the encoded sequence with elements in the dictionary in descending order of element length to obtain the encoded object, ensuring that even after elements that match the encoded object in the dictionary are removed, the encoded sequence can still be matched using the longest possible match within the dictionary.
[0020] Preferably, the method for obtaining the binary number corresponding to the encoding result is as follows: convert each encoding result into a binary number of lengths... binary numbers, where The maximum value among all encoded results. This is the integer part for rounding up.
[0021] Preferably, the step of extracting the subject's heart rate curve from the facial video includes: extracting the subject's heart rate curve from the subject's facial video using remote photoplethysmography (PPG).
[0022] The beneficial effects of this invention are as follows:
[0023] This invention converts any channel of each image frame in a face video into an encoded sequence for compression. By constructing a co-occurrence matrix of the encoded sequence, it stores the number of times any combination of gray values formed by two gray values appears in the encoded sequence. When compressing the encoded sequence, it dynamically determines whether to add the target gray string to the dictionary based on the difference between the number of times the encoded gray values of the substring of length 2 in the target gray string appear and the corresponding number in the co-occurrence matrix. This ensures that gray values that have not yet been encoded in the encoded sequence can be successfully encoded using gray strings in the dictionary, while also shortening the length of the dictionary, thus reducing the amount of data in the final compressed data and improving the transmission efficiency of face videos.
[0024] Meanwhile, this invention determines whether the target grayscale value combination will reappear in the subsequent encoding process by comparing the number of times the target grayscale value combination has appeared with the target number of times. For target grayscale value combinations that will not reappear, the target grayscale string containing the target grayscale value combination is not added to the dictionary, and the element containing the target grayscale value combination is deleted from the dictionary, which further shortens the length of the dictionary and reduces the amount of compressed data.
[0025] Furthermore, by judging the number of grayscale values to be judged, the present invention dynamically removes elements that match the encoded object in the dictionary, thereby further shortening the length of the dictionary and improving the transmission efficiency of face videos. Attached Figure Description
[0026] Figure 1 This is a schematic diagram illustrating the system block diagram of the cloud-based clinical trial data acquisition system of the present invention. Detailed Implementation
[0027] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0028] The specific embodiments of the present invention will now be described in detail with reference to the accompanying drawings.
[0029] This invention provides a cloud-based clinical trial data acquisition system. For example... Figure 1 As shown, the cloud-based clinical trial data acquisition system includes an acquisition module 100, a compression module 200, a transmission module 300, a decompression module 400, and a heartbeat signal extraction module 500, which are described in detail below.
[0030] Acquisition module 100 is used to acquire facial videos of the subjects.
[0031] Specifically, participants will record a video of their face using the front-facing camera of their smartphone, with a video length of at least 20 seconds. During the recording, participants must ensure their entire face is visible in the frame, clearly visible without any significant obstruction.
[0032] Compression module 200 is used to compress face videos.
[0033] The compression module includes an encoding sequence acquisition unit, a co-occurrence matrix construction unit, and an encoding unit, which are described in detail below.
[0034] The encoding sequence acquisition unit is used to expand the image to be compressed in the face video into an encoding sequence.
[0035] It should be noted that a face video consists of multiple image frames. In this invention, each channel of data in any image frame of a face video is treated as an independent image and compressed accordingly.
[0036] Specifically, the grayscale values of the pixels in the image to be compressed are... The sequence of the scanned pixels is unfolded into a one-dimensional sequence, which serves as the encoding sequence. In other embodiments, the implementer can customize the order in which the pixel grayscale values are unfolded, for example... Character scanning, loop scanning, etc.
[0037] Co-occurrence matrix building unit, used to construct the co-occurrence matrix of the encoded sequence.
[0038] Specifically, build a An empty matrix of size, where This represents the number of grayscale values appearing in the encoded sequence. Each grayscale value appearing in the encoded sequence is used as the row index of the matrix, and each grayscale value appearing in the encoded sequence is used as the column index of the matrix.
[0039] Combine the gray values corresponding to any row index and any column index of the matrix to form a gray value combination. Count the number of times this gray value combination appears in the encoded sequence. Locate the corresponding position in the matrix using the row index and column index, and fill the counted number into that position.
[0040] The final matrix is used as the co-occurrence matrix of the encoded sequence. Each element in the matrix represents the number of times the gray value combination consisting of the gray value corresponding to the row index of the row containing the element and the gray value corresponding to the column index of the column containing the element appears in the encoded sequence.
[0041] For example, when the encoded sequence is {3,2,2,3,1,1,2,5,2,1,2,1,5,3,5,4,3,5,2,2,3,5,1,3,5,2,4,1,5,2,3,4,2,4,3,5,1,2,3,4,4,3,5,1,2,3,4,4,3,1,3,5,2,1,4,5,4,3,3,3,1,4,2,2,4,5,2,4,4,4,3,1,5,4,1,1,1,3,5,5,3,4,5,1,5,1,3,5,1,5,5,1,5,5,4,2,5,5,1,5,4,1,1,3,5,2,5,4,3,5,5,2,4,3,5,5,5,2,4}, the corresponding co-occurrence matrix is shown in Table 1.
[0042] Table 1
[0043]
[0044] A coding unit is used to encode a coding sequence.
[0045] It should be noted that during the construction of the LZW encoding dictionary, every shortest substring appearing for the first time in the encoded sequence is added to the dictionary. This results in a long dictionary and large numerical values for each encoded result. During transmission or storage, the encoded results need to be converted to binary. If the numerical values of each encoded result are large, the corresponding binary data will be long, leading to low transmission efficiency and increased storage data volume. However, not all substrings added to the dictionary will reappear in the encoded sequence. Therefore, this invention dynamically determines whether to add the shortest substring appearing for the first time to the dictionary based on the frequency of occurrence of grayscale value combinations recorded in the co-occurrence matrix. Simultaneously, it dynamically removes existing substrings from the dictionary based on the frequency of occurrence of grayscale value combinations recorded in the co-occurrence matrix to shorten the dictionary length, making the numerical values of each encoded result smaller. This reduces the length of the encoded result after conversion to binary data, improves transmission efficiency, and reduces storage data volume.
[0046] Specifically, the process of encoding the coded sequence is as follows:
[0047] 1. Add each grayscale value appearing in the encoded sequence to an empty dictionary in ascending order, as the initial dictionary.
[0048] 2. Construct an empty sequence, denoted as the encoded sequence, to store the encoded grayscale values.
[0049] 3. Use the first gray value in the encoded sequence as the target gray value.
[0050] 4. Obtain the length of the longest element in the dictionary, denoted as D. Use the target gray value and the gray string of length D formed by the target gray value and the D-1 gray values after the target gray value in the encoded sequence as the judgment object.
[0051] 5. Match the elements in the dictionary with the judgment object.
[0052] 6. If no element in the dictionary is the same as the judgment object, remove the gray value at the end of the judgment object, use the gray string after removal as the new judgment object, and jump to step 5.
[0053] 7. In response to the existence of an element in the dictionary that is the same as the judgment object, the judgment object is used as the encoding object, the index of the element that matches the encoding object in the dictionary is used as the encoding result of the encoding object, and each gray value in the encoding object is added to the end of the encoded sequence in order.
[0054] 8. Combine the encoded object and its next grayscale value in the encoded sequence to form the target grayscale string.
[0055] 9. Obtain all substrings of length 2 in the target grayscale string, take the last substring as the first target grayscale value combination, and take the remaining substrings as a second target grayscale value combination.
[0056] For example, when the target grayscale string is {4,3,2,5}, all substrings of length 2 in the target grayscale string are {4,3}, {3,2}, and {2,5}, respectively. The last substring {2,5} is the first target grayscale value combination, and {4,3} and {3,2} are the second target grayscale value combinations.
[0057] Furthermore, for any target grayscale value combination, the element corresponding to the target grayscale value combination in the co-occurrence dictionary is taken as the target frequency of the target grayscale value combination, and the frequency of the target grayscale value combination in the encoded sequence is obtained as the frequency of occurrence of the target grayscale value combination.
[0058] If the occurrence count of the first target grayscale value combination plus one equals the target count, or the occurrence count of any second target grayscale value combination equals the target count, proceed to step 10; if the occurrence count of the first target grayscale value combination plus one is less than the target count, and the occurrence count of all second target grayscale value combinations is less than the target count, add the target grayscale string to the end of the dictionary, and proceed to step 11.
[0059] It should be noted that in step 9, the target count is the total number of times the target grayscale value combination appears in the sequence to be encoded. Therefore, the target count must be greater than or equal to the number of occurrences. Since the target grayscale string consists of the encoded object and its next grayscale value in the encoded sequence, and the encoded object has been added to the encoded sequence, the next grayscale value of the encoded object in the encoded sequence has not yet been added. The first target grayscale value combination is the grayscale value combination consisting of the last two grayscale values in the target grayscale string. Therefore, the first grayscale value in the first target grayscale value combination has been added to the encoded sequence, but the second grayscale value has not. Thus, the count of occurrences of the first target grayscale value combination does not include the occurrence count in the current target grayscale string. Therefore, it is necessary to increment the count by one before comparing it with the target count.
[0060] It should be further explained that if the number of occurrences of the first target grayscale value combination plus one is less than the target number, it means that the first target grayscale value combination will appear again in the subsequent encoding process; similarly, if the number of occurrences of the second target grayscale value combination is less than the target number, it means that the second target grayscale value combination will appear again in the subsequent encoding process. When all target grayscale value combinations will appear again, these target grayscale value combinations may appear in the form of target grayscale strings. Therefore, the target grayscale strings need to be added to the dictionary so that when they appear again, their corresponding element in the dictionary can be used for encoding. Conversely, if the number of occurrences of the first target grayscale value combination plus one equals the target number, it means that the first target grayscale value combination will not appear again in the subsequent encoding process; similarly, if the number of occurrences of the second target grayscale value combination equals the target number, it means that the second target grayscale value combination will not appear again in the subsequent encoding process. When any target grayscale value combination will not reappear, the target grayscale string containing the target grayscale value combination will also not reappear. Subsequently, the index of the element corresponding to the target grayscale string in the dictionary will not be used to encode the new encoding object, and there is no need to add the target grayscale string to the dictionary.
[0061] 10. If the number of occurrences of the first target grayscale value combination plus one equals the target number, then the first target grayscale value combination is considered a grayscale value combination to be removed. If the number of occurrences of the second target grayscale value combination equals the target number, then the second target grayscale value combination is considered a grayscale value combination to be removed. Remove all elements in the dictionary that contain grayscale value combinations to be removed. Go to step 12.
[0062] It should be noted that in the subsequent encoding process, the gray value combination to be removed will not reappear, and therefore all gray strings containing the gray value combination to be removed will not reappear. The index of the element containing the gray value combination to be removed in the dictionary will not be used for encoding. Therefore, the element containing the gray value combination to be removed in the dictionary will be removed to shorten the length of the dictionary and make the encoding result of each subsequent encoding object as small as possible.
[0063] 11. Record the length of the encoded object as... Get the dictionary with a length not less than , and before All elements with grayscale values of the encoded object are used as the target element.
[0064] For any target element, select the first element from the target element. Each grayscale value is used as the grayscale value to be judged. The last grayscale value in the encoded object is used as the index grayscale value. The number of non-zero elements in the row of the co-occurrence matrix whose index is the index grayscale value is obtained, denoted as W. In response to the condition that the number of grayscale value categories to be judged is equal to the number W of non-zero elements in the row of the co-occurrence matrix whose index is the index grayscale value, the corresponding element of the encoded object in the dictionary is removed from the dictionary.
[0065] It should be noted that in the encoded sequence, there are W possible combinations of gray values starting with an index gray value, and the target element is the... The grayscale value is the index grayscale value, and the first grayscale value is the index grayscale value. If each grayscale value is a judgment grayscale value, then the number of grayscale value combinations formed by the index grayscale value and the grayscale value to be judged depends on the number of grayscale value combinations to be judged, and will not exceed W. Therefore, when the number of grayscale value combinations to be judged is equal to W, it means that all possible substrings containing the grayscale value combination corresponding to the index grayscale value, starting from the encoded object, already exist in the dictionary. When the encoded object reappears in the encoding sequence, it will definitely appear as a target element. In this case, it needs to be encoded using the index of the corresponding target element, without needing to use the index of the element corresponding to the encoded object in the dictionary. Therefore, the element corresponding to the encoded object in the dictionary can be removed to shorten the dictionary length. Conversely, when the number of grayscale value combinations to be judged is less than W, it means that all possible substrings containing the grayscale value combination corresponding to the index grayscale value, starting from the encoded object, have not all been added to the dictionary. When the encoded object reappears in the encoding sequence, it may still need to be encoded using the index of the element corresponding to the encoded object in the dictionary. Therefore, the element corresponding to the encoded object in the dictionary cannot be removed from the dictionary.
[0066] For example, if the encoded object is {4,3,2}, the dictionary has a length of at least 4, and the first three grayscale values are all elements of the encoded object: {4,3,2,5}, {4,3,2,7}, {4,3,2,1}, and {4,3,2,1,1}, then the target elements are {4,3,2,5}, {4,3,2,7}, {4,3,2,1}, and {4,3,2,1,1}. The grayscale values to be determined are 5, 7, and 1, and the index grayscale value is 2. The number of grayscale value categories to be determined is 3.
[0067] If the non-zero elements in the row with index 2 of the co-occurrence matrix are 1, 5, and 7 respectively, then W=3. This means that when the encoded object {4,3,2} appears again in the encoding sequence, its next gray value must be one of 1, 5, or 7. Therefore, the encoded object {4,3,2} and its next gray value can be encoded directly using the index of the corresponding target element in the dictionary. Thus, the element corresponding to the encoded object {4,3,2} in the dictionary can be removed from the dictionary to shorten the length of the dictionary.
[0068] If the row index of the co-occurrence matrix has non-zero elements of 1, 5, 6, and 7 in the row with gray value 2, then W=4. This means that when the encoded object {4,3,2} reappears in the encoded sequence, its next gray value must be one of 1, 5, 6, or 7. Therefore, the encoded object may be... When {4,3,2,5}, {4,3,2,7}, {4,3,2,1}, and {4,3,2,1,1} appear in the dictionary, the indexes of {4,3,2,6} in the dictionary cannot be used to encode {4,3,2,6}. Instead, the index of the corresponding element in the dictionary must be used to encode {4,3,2} first, and then {6}. Therefore, the element corresponding to the encoded object in the dictionary cannot be removed from the dictionary.
[0069] 12. Use the next grayscale value of the encoded object in the encoding sequence as the new target grayscale value.
[0070] 13. Repeat steps 4 to 12 until all grayscale values in the encoded sequence have been encoded, then stop iterating.
[0071] 14. Convert all the obtained encoding results to a length of The binary numbers are obtained by concatenating all the binary numbers together in the order they were obtained from the encoding results, resulting in compressed data. The maximum value among all encoded results. This is the integer part for rounding up.
[0072] This completes the individual compression of each channel data in each image frame of the face video, resulting in compressed data.
[0073] For example, when the encoded sequence is {3,2,2,3,1,1,2,5,2,1,2,1,5,3,5,4,3,5,2,2,3,5,1,3,5,2,4,1,5,2,3,4,2,4,3,5,1,2,3,4,4,3,5,1,2,3,4,4,3,1,3,5,2,1,4,5,4,3,3,3,1,4,2,2,4,5,2,4,4,4,3,1,5,4,1,1,1,3,5,5,3,4,5,1,5,1,3,5,1,5,5,1,5,4,2,5,5,1,5,4,1,1,3,5,2,5,4,3,5,5,2,4,3,5,5,5,2,4}, the initial dictionary is shown in Table 2.
[0074] Table 2
[0075]
[0076] The encoding process for the encoded sequence is as follows:
[0077] Construct the encoded sequence {}. Take the first grayscale value 3 in the encoded sequence as the target grayscale value. The longest element in the dictionary has a length of 1, so the judgment object is 3. The element with index 3 in the dictionary is the same as the judgment object, so the judgment object 3 is taken as the encoding object. The index 3 is taken as the encoding result of the encoding object 3. Add the encoding object 3 to the encoded sequence, so the encoded sequence is {3}. The target grayscale string {3,2} is formed by encoding object 3 and its next grayscale value 2 in the encoding sequence. The substring of length 2 in the target grayscale string {3,2} is {3,2}. The first target grayscale value combination is {3,2}. {3,2} corresponds to element 1 in the 3rd row and 2nd column of the co-occurrence dictionary. Therefore, the target frequency of {3,2} is 1. Since {3,2} has not appeared in the encoded sequence, the frequency of {3,2} is 0. The frequency of occurrence is 1 after incrementing by one, which is the same as the target frequency. Therefore, the target grayscale string is not added to the dictionary, and {3,2} is treated as a grayscale value combination to be removed. Since there is no element in the dictionary that contains a grayscale value combination to be removed, the dictionary is not modified.
[0078] Taking the next grayscale value 2 in the encoding sequence as the target grayscale value, and the longest element in the dictionary with a length of 1, the judgment object is 2. The element with index 2 in the dictionary is the same as the judgment object, so judgment object 2 is taken as the encoding object, and index 2 is taken as the encoding result of encoding object 2. Encoding object 2 is added to the already encoded sequence, so the already encoded sequence is {2}. Encoding object 2 and the next grayscale value 2 in the encoding sequence form the target grayscale string {2,2}. The substring of length 2 in the target grayscale string {2,2} is {2,2}, so the first target grayscale value combination is {2,2}. {2,2} corresponds to the element 3 in the 2nd row and 2nd column of the co-occurrence dictionary, so the target frequency of {2,2} is 3. {2,2} does not appear in the already encoded sequence, so the frequency of {2,2} is 0. The frequency of the frequency is 1, which is less than the target frequency of 3, so the target grayscale string {2,2} is added to the dictionary. The length of the encoded object 2 is 1, and the length of the dictionary is not less than 1+1=2. The element with the first gray value of the encoded object does not exist, so no removal operation is performed on the dictionary. The dictionary at this time is shown in Table 3.
[0079] Table 3
[0080]
[0081] Similarly, encoding the following grayscale values in the encoded sequence {2,3,1,1,2,5,2,1,2,1,5,3,5,4,3,5,2,2,3,5,1,3,5,2,4,1,5,2,3,4,2,4,3,5,1,2,3,4,4,3,1,3,5,2,1,4,5,4,3,3,3,1,4,2,2,4,5} yields the encoded result {2,3,1,1,2,5,2,10,1,5,3,5,4,17,6,17,1,20,4}. The encoded sequence is {3,2,2,3,1,1,2,5,2,1,2,1,5,3,5,4,3,5,2,2,3,5,1,3,5,2,4,1,5,2,3,4,2,4,3,5,1,2,3,4,4,3,5,1,2,3,4,4,3,5,1,2,3,4,4,3,1,3,5,2,1,4,5,4,3,3,3,1,4,2,2,4,5}. The corresponding dictionary is shown in Table 4.
[0082] Table 4
[0083]
[0084] Taking the next grayscale value 2 in the encoding sequence as the target grayscale value, and the longest element in the dictionary has a length of 4, the judgment object is {2,4,4,4}. Since no element in the dictionary matches the judgment object {2,4,4,4}, {2,4,4} is used as the new judgment object. Since no element in the dictionary matches the judgment object {2,4,4}, {2,4} is used as the new judgment object. The element with index 20 in the dictionary matches the judgment object {2,4}, so {2,4} is used as the encoding object. If 20 is the encoding result of the encoding object {2,4}, then each grayscale value in the encoding object {2,4} is added to the encoded sequence, and the encoded sequence is {3,2,2,3,1,1,2,5,2,1,2,1,5,3,5,4,3,5,2,2,3,5,1,3,5,2,4,1,5,2,3,4,2,4,3,5,1,2,3,4,4,3,1,3,5,2,1,4,5,4,3,3,3,1,4,2,2,4,5,2,4}. The encoded object {2,4} and its next grayscale value 4 in the encoded sequence form the target grayscale string {2,4,4}. The substrings of length 2 in the target grayscale string {2,4,4} are {2,4} and {4,4}. Therefore, the first target grayscale value combination is {4,4}, and the second target grayscale value combination is {2,4}. {4,4} corresponds to element 3 in the 4th row and 4th column of the co-occurrence dictionary, so the target frequency of {4,4} is 3. Since {4,4} appears once in the encoded sequence, its occurrence count is 1. Increasing the occurrence count by one gives 2, which is less than the target frequency of 3. {2,4} corresponds to element 6 in the 2nd row and 4th column of the co-occurrence dictionary, so the target frequency of {2,4} is 6. Since {2,4} appears four times in the encoded sequence, its occurrence count is 4, which is less than the target frequency of 6. Therefore, the target grayscale string {2,4,4} is added to the dictionary. If the length of the encoded object {2,4} is 2, then If there are no elements in the dictionary with a length of not less than 3 and whose first two gray values are the encoded object {2,4}, then no removal operation is performed on the dictionary. The dictionary in this case is shown in Table 5.
[0085] Table 5
[0086]
[0087] Taking the next grayscale value 4 in the encoding sequence as the target grayscale value, and considering that the longest element in the dictionary has a length of 4, the judgment object is {4,4,3,1}. Since no element in the dictionary matches {4,4,3,1}, {4,4,3} is used as the new judgment object. Similarly, since no element in the dictionary matches {4,4,3}, {4,4} is used as the new judgment object. The element with index 24 in the dictionary matches {4,4}, so {4,4} is used as the encoding object, and index 24 is used as the encoding object. As the encoding result of the encoding object {4,4}, each grayscale value in the encoding object {4,4} is added to the encoded sequence, which is {3,2,2,3,1,1,2,5,2,1,2,1,5,3,5,4,3,5,2,2,3,5,1,3,5,2,4,1,5,2,3,4,2,4,3,5,1,2,3,4,4,3,5,1,2,3,4,4,3,1,3,5,2,1,4,5,4,3,3,3,1,4,2,2,4,5,2,4,4,4}. The target grayscale string {4,4,3} is formed by combining the encoded object {4,4} and the next grayscale value 3 of the encoded object in the encoded sequence. The substrings of length 2 in the target grayscale string {4,4,3} are {4,4} and {4,3}. Then the first target grayscale value combination is {4,3} and the second target grayscale value combination is {4,4}. {4,3} corresponds to element 7 in the 4th row and 3rd column of the co-occurrence dictionary. Therefore, the target frequency of {4,3} is 7. Since {4,3} appears 4 times in the encoded sequence, the current frequency of {4,3} is 4. The current frequency plus one is 5, which is less than the target frequency of 7. {4,4} corresponds to element 3 in the 4th row and 4th column of the co-occurrence dictionary. Therefore, the target frequency of {4,4} is 3. Since {4,4} appears 3 times in the encoded sequence, the current frequency of {4,4} is 3, which is equal to the target frequency of 3. Therefore, the target grayscale string {4,4,3} is not added to the dictionary, and {4,4} is treated as a grayscale value combination to be removed. The elements {4,4} with index 20 and {2,4,4} with index 30 in the dictionary contain the grayscale value combination {4,4} to be removed. Therefore, the dictionary elements {4,4} and {2,4,4} are removed. The dictionary at this time is shown in Table 6.
[0088] Table 6
[0089]
[0090] Similarly, the remaining grayscale values in the encoding sequence are encoded. The encoding results obtained by encoding all grayscale values in the encoding sequence are {3,2,2,3,1,1,2,5,2,10,1,5,3,5,4,17,6,17,1,20,4,15,7,4,2,18,4,9,2,3,15,18,9,1,3,12,2,31,28,4,27,20,24,4,10,4,23,8,22,7,21,7,17,3,19,18,14,4,10,4,12,6}. The final dictionary is shown in Table 7.
[0091] Table 7
[0092]
[0093] For example, when the encoded sequence is {3,2,2,3,1,1,2,5,2,1,2,1,5,3,5,4,3,5,2,2,3,5,1,3,5,2,4,1,5,2,3,4,2,4,3,5,1,2,3,4,4,3,1,3,5,2,1,4,5,4,3,3,3,1,4,2,2,4,5,2,4,4,4,3,1,5,4,1,1,1,3,5,5,3,4,5,1,5,1,3,5,1,5,4,2,5,5,1,5,4,1,1,3,5,2,5,4}, When the sequence is 3,5,5,2,4,3,5,5,5,2,4, the traditional LZW encoding is applied, resulting in the encoding result {3,2,2,3,1,1,2,5,2,11,1,5,3,5,4,18,7,18,1,21,4,16,8,4,2,20,5,11,3,4,20,24,13,1,4,19,3,42,39,7,40,30,35,9,19,10,37,17,40,16,37,16,29,5,32,50,37,12,31,13,64,65}. The corresponding LZW encoding dictionary is shown in Table 8.
[0094] Table 8
[0095]
[0096] It can be seen that the maximum value in the encoding result obtained by the method in this invention is 31, therefore each encoding result needs to be converted to a length of If the binary number is encoded into 62 characters, then the final length of the compressed data is 62. The maximum value in the encoding result obtained using traditional LZW encoding is 65, therefore each encoding result needs to be converted to a length of... If the binary number is encoded into 62 characters, then the final length of the compressed data is 62. Therefore, the method in this invention can reduce the compression ratio and improve transmission efficiency compared to traditional LZW encoding.
[0097] The transmission module 300 is used to upload compressed data to the cloud platform.
[0098] To ensure the compressed data can be decompressed, the co-occurrence matrix must also be transmitted to the cloud platform. Since the row index and column index of the co-occurrence matrix are the same, only one of the row index and column index needs to be transmitted when transmitting the co-occurrence matrix.
[0099] Implementers can also compress the co-occurrence matrix before transmission to further reduce the amount of data transmitted, for example, by using Huffman coding to compress the co-occurrence matrix.
[0100] The decompression module 400 is used to decompress compressed data and restore the face video based on the decompression result.
[0101] Specifically, after receiving the compressed data, the cloud platform decompresses the data as follows:
[0102] 1. Compress the data into individual... Divide a binary number into bits, convert all the resulting binary numbers into decimal numbers, use each decimal number as an encoding result, and combine all the encoding results into an encoding result sequence.
[0103] 2. Construct an empty dictionary and add all the gray values corresponding to the row indices of the co-occurrence matrix in ascending order to the empty dictionary as the initial dictionary.
[0104] 3. Construct an empty sequence, denoted as the decoded sequence, to store the decoded grayscale values.
[0105] 4. Take the first encoded result in the encoded result sequence as the element to be decoded.
[0106] 5. Obtain the element with the index of the element to be decoded from the dictionary, and use it as the decoding result of the element to be decoded. Add each grayscale value in the decoding result to the end of the decoded sequence in order.
[0107] 6. Take the next encoding result of the element to be decoded in the encoding result sequence as the target encoding result. Determine whether there is an element with the index of the target encoding result in the dictionary. If there is an element with the index of the target encoding result in the dictionary, append the first gray value of the element to the end of the decoding result of the element to be decoded, and take the resulting gray string as the target gray string. If there is no element with the index of the target encoding result in the dictionary, append the first gray value of the decoding result of the element to be decoded to the end of the decoding result of the element to be decoded, and take the resulting gray string as the target gray string.
[0108] 7. Obtain all substrings of length 2 in the target grayscale string, take the last substring as the first target grayscale value combination, and take the remaining substrings as a second target grayscale value combination.
[0109] For any target grayscale value combination, the element corresponding to the target grayscale value combination in the co-occurrence dictionary is taken as the target frequency of the target grayscale value combination. The frequency of the target grayscale value combination in the encoded sequence is obtained as the frequency of occurrence of the target grayscale value combination.
[0110] If the occurrence count of the first target grayscale value combination plus one equals the target count, or the occurrence count of any second target grayscale value combination equals the target count, proceed to step 8; if the occurrence count of the first target grayscale value combination plus one is less than the target count, and the occurrence count of all second target grayscale value combinations is less than the target count, add the target grayscale string to the end of the dictionary, and proceed to step 9.
[0111] 8. If the number of occurrences of the first target grayscale value combination plus one equals the target number, then the first target grayscale value combination is considered a grayscale value combination to be removed. If the number of occurrences of the second target grayscale value combination equals the target number, then the second target grayscale value combination is considered a grayscale value combination to be removed. Remove all elements in the dictionary that contain grayscale value combinations to be removed. Go to step 10.
[0112] 9. Record the length of the decoding result of the element to be decoded as Get the dictionary with a length not less than , and before All elements whose grayscale value is the decoding result of the element to be decoded are taken as the target element.
[0113] For any target element, select the first element from the target element. Each gray value is used as the gray value to be judged.
[0114] Use the last grayscale value in the decoding result of the element to be decoded as the index grayscale value, and obtain the number of non-zero elements in the row with the index grayscale value in the co-occurrence matrix.
[0115] In response to the fact that the number of grayscale values to be determined is equal to the number of non-zero elements in the row index of the co-occurrence matrix, the element corresponding to the decoding result of the element to be decoded is removed from the dictionary.
[0116] 10. Take the next encoded result in the sequence of encoded results of the element to be decoded as the new element to be decoded.
[0117] 11. Repeat steps 5 to 10 until all encoded results in the encoded result sequence have been decoded, then stop the iteration.
[0118] 12. Arrange all the decoded results into a sequence according to the order in which they were obtained, and use this sequence as the grayscale value sequence. Fill the grayscale value sequence into a unit according to the scan order in the encoding unit of the compression module. Within an empty matrix of a certain size, the image to be compressed in compression module 200 is restored. This refers to the number of rows in the image corresponding to each channel of data for each image frame in a face video. This is the number of columns of the image corresponding to each channel of data in each image frame of a face video.
[0119] Furthermore, the facial video is reconstructed based on the decompression results, including:
[0120] Based on the reconstructed images corresponding to each channel data of the same image frame in the face video, the image frame is reconstructed, and the reconstruction results of all image frames constitute the face video.
[0121] At this point, the facial video was restored.
[0122] The heart rate data extraction module 500 is used to extract the heart rate curve of the subject based on the facial video.
[0123] Specifically, rPPG technology was used to extract the heart rate curves of the subjects from their facial videos.
[0124] It should be noted that rPPG technology is a non-contact physiological monitoring technology that captures changes in microvessels on the surface of human skin using a camera. Its core principle is to analyze the light signals caused by the periodic changes in the intensity of light reflected from the skin due to blood flow during a heartbeat, thereby extracting physiological indicators such as heart rate and respiratory rate. The specific steps of rPPG are well-known technologies and will not be described in detail here.
Claims
1. A cloud-based clinical trial data acquisition system, characterized in that, include: The data acquisition module collects facial videos of the subjects. Compression module, S1: expands the channel data of each image frame of the face video into an encoded sequence; S2: Construct the co-occurrence matrix of the encoding sequence and the initial dictionary. By constructing the co-occurrence matrix of the encoding sequence, store the number of times the gray value combination formed by any two gray values appears in the encoding sequence; S3: Match the encoding sequence with the elements in the dictionary in descending order of the length of the elements to obtain the encoding object. Use the index of the element that matches the encoding object in the dictionary as the encoding result of the encoding object. The process involves: S1) constructing the target grayscale string from the encoded object and the next grayscale value in the encoded sequence; S2) deciding whether to add the target grayscale string to the end of the dictionary; S3) obtaining all substrings of length 2 in the target grayscale string, using the last substring as the first target grayscale value combination, and using the remaining substrings as second target grayscale value combinations; S4) for any target grayscale value combination, using the element corresponding to the target grayscale value combination in the co-occurrence dictionary as the target frequency of the target grayscale value combination, and obtaining the frequency of the target grayscale value combination in the encoded sequence as the frequency of occurrence of the target grayscale value combination; S5) adding the target grayscale string to the end of the dictionary when the frequency of occurrence of the first target grayscale value combination plus one is less than the target frequency, and the frequency of occurrence of all second target grayscale value combinations is less than the target frequency; S6) repeating S7 until all grayscale values in the encoded sequence have been encoded; and S8) concatenating the binary numbers corresponding to all the encoded results to obtain the compressed data. The transmission module uploads the compressed data and the row or column indexes in the co-occurrence matrix to the cloud platform; The decompression module decompresses the compressed data and reconstructs the face video based on the decompression results; The heart rate data extraction module extracts the subject's heart rate curve based on the facial video. The compression module further includes: In response to the first target grayscale value combination having appeared once and then equaling the target number, the first target grayscale value combination is taken as a grayscale value combination to be removed. In response to any second target grayscale value combination having appeared once and then equaling the target number, the second target grayscale value combination is taken as a grayscale value combination to be removed. All elements in the dictionary that contain grayscale value combinations to be removed are removed from the dictionary. In response to appending the target grayscale string to the end of the dictionary, the length of the encoded object is denoted as... , the dictionary with a length not less than , and before Take all elements with a grayscale value of _th as the encoded object, and treat each as a target element; for any target element, take the _th grayscale value of _th element as the target element. One gray value is used as the gray value to be judged; the last gray value in the encoded object is used as the index gray value, and the number of non-zero elements in the row with the index gray value in the co-occurrence matrix is obtained, denoted by W; in response to the number of gray values to be judged being equal to W, the elements that match the encoded object in the dictionary are removed from the dictionary.
2. The cloud-based clinical trial data acquisition system according to claim 1, characterized in that, The step of unfolding the channel data of each image frame of the face video into an encoded sequence includes: Each channel of any image frame in a face video is treated as an independent image to be compressed. The gray values of the pixels in the image to be compressed are unfolded into a one-dimensional sequence in an S-shaped scanning order, which is used as the encoding sequence.
3. The cloud-based clinical trial data acquisition system according to claim 1, characterized in that, The co-occurrence matrix for constructing the encoded sequence includes: Build a An empty matrix of size, where This represents the number of grayscale values that appear in the encoded sequence. Each grayscale value that appears in the encoded sequence is used as the row index of the matrix, and each grayscale value that appears in the encoded sequence is used as the column index of the matrix. Combine the gray value corresponding to any row index of the matrix with the gray value corresponding to any column index to form a gray value combination. Count the number of times this gray value combination appears in the encoded sequence. Locate the corresponding position in the matrix using the row index and column index, and fill the counted number into that position. The final matrix is used as the co-occurrence matrix of the encoded sequence.
4. The cloud-based clinical trial data acquisition system according to claim 1, characterized in that, The method for constructing the initial dictionary includes: Each grayscale value appearing in the encoded sequence is added to an empty dictionary in ascending order to form the initial dictionary.
5. The cloud-based clinical trial data acquisition system according to claim 1, characterized in that, The step of matching the encoded sequence with the elements in the dictionary in descending order of element length to obtain the encoded object includes: Get the length of the longest element in the dictionary, denoted as D, and use the gray string of length D formed by the D unencoded gray values in the encoded sequence as the judgment object; The dictionary elements are matched against the judgment object. If no element in the dictionary matches the judgment object, the grayscale value at the end of the judgment object is removed, and the grayscale string after removal is used as the new judgment object. If an element in the dictionary matches the judgment object, the judgment object is used as the encoding object.
6. The cloud-based clinical trial data acquisition system according to claim 1, characterized in that, The method for obtaining the binary number corresponding to the encoding result is as follows: Convert each encoded result to a length of... binary numbers, where The maximum value among all encoded results. This is the integer part for rounding up.
7. The cloud-based clinical trial data acquisition system according to claim 1, characterized in that, The step of extracting the subject's heart rate curve from the facial video includes: The heart rate curve of the subjects was extracted using remote photoplethysmography (PPG) technology from their facial videos.
Citation Information
Patent Citations
Smart community face data storage method and system
CN116521093A
Data compression method based on LZW coding
CN118842474A
Non-contact health monitoring method with privacy protection characteristic
CN118986291A