Intelligent beef cattle body size measuring device and method
By generating identity binding codes through multi-angle image acquisition and dictionary block reordering algorithms, combined with cooling cycle control and batch submission, the body size change sequence features are constructed, simulation enhancement samples are screened, and correlation coefficients between fields are calculated. This solves the problems of data continuity and model accuracy in beef cattle body size measurement, and realizes efficient and accurate body size monitoring and breeding support.
Patent Information
- Application Number
- CN202511190733.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-08-25
- Publication Date
- 2025-12-19
AI Technical Summary
Existing technologies are prone to triggering stress responses in measuring the body size of beef cattle, affecting the continuity and accuracy of data acquisition. They cannot meet the needs of high-frequency, multi-time period, and multi-batch dynamic monitoring, resulting in repeated recording and waste of storage resources. Model training carries the risk of overfitting, fails to effectively analyze the differences in beef cattle growth stages, and affects the accuracy of breeding decisions.
By acquiring multi-angle images of a single beef cattle, the distance between the shoulder peak and the trunk baseline pixels in the gridded area is extracted, the difference in pixel gray values of the back fat layer is calculated, and an identity binding code is generated by combining a dictionary block reordering algorithm. The cooling cycle and batch submission are controlled to construct the body size change sequence features, screen the simulation enhancement sample set, calculate the correlation coefficient between fields, and construct the modeling sample pool.
It achieves uniqueness and stability in individual beef cattle identification, reduces the risk of identification confusion, optimizes data storage efficiency, dynamically monitors body size change trends, improves model fitting accuracy and generalization ability, enhances sample representativeness and variable combination diversity, and improves the accuracy of breeding decisions.
Smart Images

Figure CN121167299A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of livestock measurement, in particular to a beef cattle body size intelligent measurement device and method. BACKGROUND
[0002] The technical field of livestock measurement aims to objectively evaluate the body shape, growth and development status, health status and production performance of livestock through quantitative and standardized means, including measurement, recording and analysis of body size parameters, with the goal of providing reliable data support for livestock breeding selection, feeding management, health monitoring, precision feeding and economic value evaluation, and improving the efficiency of livestock production, animal welfare level and the scientific nature of management decisions.
[0003] A beef cattle body size intelligent measurement method aims to improve the automation and accuracy of body size data acquisition, quickly acquire key body size parameters of beef cattle without disturbing their normal activity, establish a standardized measurement model, realize structured extraction and analysis of data, support subsequent breeding evaluation, nutrition regulation and transaction pricing business links, and meet the dual requirements of data quality and operational convenience for large-scale and intelligent farms.
[0004] The prior art can easily cause stress reactions in beef cattle, affecting the continuity and authenticity of data acquisition, the objectivity of measurement results, and there are significant limitations in data collection frequency, which cannot meet the needs of high-frequency, multi-period and multi-batch dynamic monitoring, making it difficult to timely grasp the body size change trend of beef cattle individuals, and without setting a write cooling period and batch submission mechanism, leading to repeated recording and waste of storage resources, reducing data management efficiency, and lacking statistics on body size change trends, ignoring the quantitative characteristics of increasing and decreasing intervals, unable to effectively analyze the differences in beef cattle growth stages, affecting the accuracy of breeding decisions, and the sample expansion method has bias, leading to overfitting risk in model training, without screening and optimizing the correlation between body size fields, there is low correlation field redundancy input, affecting the efficiency and accuracy of model prediction. SUMMARY
[0005] The purpose of the present application is to solve the shortcomings in the prior art and provide a beef cattle body size intelligent measurement device and method.
[0006] To achieve the above purpose, the present application adopts the following technical scheme: a beef cattle body size intelligent measurement method, comprising the following steps:
[0007] S1: Collecting multi-angle images of single beef cattle through a sensor, extracting the pixel distance of the shoulder peak and the trunk baseline in the grid area image, accumulating the horizontal pixel projection width of the image, calculating the pixel gray value difference of the back fat layer, using the lexicographic block reordering algorithm, converting the pixel coordinates of the hoof joint and calculating the angle difference, and generating an identity binding code;
[0008] S2: receiving beef cattle body size value and measurement time field based on the identity binding code, extracting the current measurement time and comparing with the writing time in the database with the same code, judging whether it exceeds the writing cooling period, if not, adding to the writing queue, if it exceeds, performing batch submission, obtaining body size measurement storage index;
[0009] S3: based on the body size measurement storage index, retrieving all measurement records under the same identity code, sorting in ascending order according to the measurement time field, calculating the difference value of beef cattle body size value between consecutive records, counting the length and slope of consecutive increasing and decreasing intervals, forming the body size change sequence characteristics;
[0010] S4: based on the body size change sequence characteristics, constructing body type category code and age scalar combination, and performing local pixel block rendering, using generative adversarial network to calculate generated sample pixel difference value, comparing true and false scores and filtering out samples that meet the threshold, obtaining the simulation enhanced sample set;
[0011] S5: based on the simulation enhanced sample set, extracting beef cattle body size field and corresponding position code value, calculating the correlation coefficient between each field, filtering out field pairs below the set threshold, retaining field pairs for cross combination, generating a modeling sample pool.
[0012] As a further scheme of the present application, the identity binding code includes difference sequence, timestamp information and hash string, the body size measurement storage index includes identity binding code, measurement timestamp and body size field set, the body size change sequence characteristics include continuous growth interval length, continuous decline interval length and slope change value, the simulation enhanced sample set includes filtered pixel vector, error threshold mark and true and false score, and the modeling sample pool includes field pair combination, cross vector set and field index list.
[0013] As a further scheme of the present application, the specific steps for generating the identity binding code are:
[0014] Collecting multi-angle images of single beef cattle through sensors, dividing grid regions according to image rows and columns based on the multi-angle images of single beef cattle collected by sensors, scanning each row of gray value to mark shoulder peak coordinates, searching for bottom continuous pixel to mark trunk baseline coordinates, calculating the vertical pixel distance between the two points, and generating shoulder pixel distance data;
[0015] Based on the shoulder pixel distance data, accumulating each column of effective pixel to mark the horizontal projection width in the image column direction, traversing the pixel coordinates of the back region to extract the gray value, outputting the difference value of the gray peak value and the valley value, and obtaining the body type gray width data;
[0016] Based on the body size gray width data, a lexicographic block reordering algorithm is used to locate the key pixel points of the hoof area, extract four groups of coordinates, convert the coordinate pairs into vector structures, calculate the included angle difference, output the angle floating value and correct the error, and obtain the identity binding code.
[0017] As a further scheme of the present application, the lexicographic block reordering algorithm divides the image into fixed-size pixel blocks, globally sorts each pixel block in lexicographic order after extracting the gray vector of each pixel block, and rearranges the order of the image blocks according to the sorting result to form a reordered image matrix, highlighting the structural boundary and regional change characteristics.
[0018] As a further scheme of the present application, the specific steps for generating the body size measurement storage index are:
[0019] Based on the identity binding code, the beef cattle body size value and the measurement time field are received, the value corresponding to the measurement time field is extracted, the current system time is synchronized and compared, the time field value in the same encoding history record is read, the difference between the two time field values is calculated and compared with the fixed threshold value of the cooling period, and the cooling state identifier is generated;
[0020] Based on the cooling state identifier, the record writing mode is determined, the current record buffer state is read and a data write linked list structure is established, if the cooling state is in the cooling state, the data is written to the tail of the write linked list and the write cache flag is kept, if the non-cooling state is in the non-cooling state, the data in the linked list is read and written to the database table, and then the linked list is emptied, and the body size measurement storage index is obtained.
[0021] As a further scheme of the present application, the specific steps for generating the body size change sequence feature are:
[0022] Based on the body size measurement storage index, all measurement records under the same identity code are retrieved, the measurement time field and the body size value field of each record are extracted, the record order is arranged in ascending order of the measurement time field, the time-ordered sequence is established and the data position information index table is constructed, and the ordered list of measurement records is obtained.
[0023] Based on the ordered list of measurement records, the body size value fields in adjacent records are extracted pair by pair, the difference between the two value fields is calculated, the difference interval is determined, and the length of the continuous increasing and decreasing interval is accumulated, the first and last measurement times of each interval are extracted, and the value difference ratio is calculated as the slope value, and the body size change sequence feature is generated.
[0024] As a further scheme of the present application, the specific steps for generating the simulation enhanced sample set are:
[0025] Based on the body size change sequence feature, a type class code is combined with a month age scalar field, the combination field generates input row data, the field segment is separated and each field position is marked, the format is converted into a standard row-column form input condition module, and a condition input field set is generated;
[0026] Based on the condition input field set, a generative adversarial network is used, an image original information block is located according to a field index, a rendering operation is performed on a pixel partition in an index range, a difference value list is formed by comparing the rendered pixel value with the original value, and a local pixel difference sequence is obtained.
[0027] Based on the local pixel difference sequence, all pixel blocks exceeding a set range are screened out, valid pixel vectors are integrated and reordered in sequence, a complete mapping structure is output as an image sample set, and a simulation enhanced sample is obtained.
[0028] As a further scheme of the present application, the generative adversarial network first maps the condition input field set into a condition vector, combines the corresponding image original information block according to the field index, generates a network with the condition vector as the input, performs a pixel rendering operation on the selected pixel partition, then a discriminant network receives the rendered pixel block and the original pixel block in parallel, extracts features through a convolution layer and a full connection layer and calculates a true-false score, and finally the network and the discriminant network are alternately iterated and updated parameters under the driving of the reverse propagation of the discriminant error, and the pixel-by-pixel difference value list between the rendered pixel value and the original value is the local pixel difference sequence.
[0029] As a further scheme of the present application, the specific steps for generating the modeling sample pool are as follows:
[0030] Based on the simulation enhanced sample set, beef cattle body size field numerical values and corresponding position encoding numerical values are extracted, sample entries are batch read and a double-column numerical value list is generated, each column value difference is calculated and accumulated, and a ratio is calculated and a difference is calculated, a field correlation coefficient table is generated;
[0031] Based on the field correlation coefficient table, all field pairs below a set numerical threshold are screened out, the remaining field pair indexes are extracted and a matching list is established, the matching list is traversed to perform bidirectional permutation and combination of field values and merge numerical vectors, and list deduplication and merging are performed, and a modeling sample pool is generated.
[0032] A beef cattle body size intelligent measurement device, comprising a memory and a processor, the memory stores a computer program, and the processor implements the steps of the beef cattle body size intelligent measurement method when executing the computer program.
[0033] Compared with the prior art, the present application has the following advantages and positive effects:
[0034] In the application, by collecting multi-angle images of single-head beef cattle, the pixel distance of shoulder peak value and trunk baseline in the grid area, the cumulative image transverse pixel projection width, and the pixel gray value difference of the back fat layer are extracted, the pixel coordinates of the hoof joint are converted and the angle difference is calculated by combining the lexicographic block reordering algorithm, and the identity binding code is accurately generated, thereby ensuring the uniqueness and stability of the individual identification of beef cattle and effectively reducing the identification confusion risk when multiple beef cattle are measured at the same time.
[0035] In the application, the data storage efficiency is controlled by dynamic queue and batch submission, the effectiveness of data writing in high-frequency measurement scenarios is ensured, and redundant records are reduced, all measurement records under the same identity code are retrieved and sorted in ascending order of time, the numerical difference of continuous records is calculated, the length and slope of the increasing and decreasing intervals are counted, and the body size change sequence characteristics are formed, which is helpful for dynamically monitoring the body size change trend and development rhythm of beef cattle.
[0036] In the application, the simulation samples are generated by local pixel block rendering and generative adversarial network, and the samples meeting the threshold value are selected according to the true and false scores, the sample richness is improved, the coverage of the model training set is optimized, the body size field and position encoding values are extracted, the correlation coefficients between fields are calculated, the low-correlation field pairs are removed, only the high-correlation fields are reserved for cross combination, the modeling sample pool is constructed, the representativeness and variable combination diversity of the samples are enhanced, and the fitting precision and promotion ability of the body size estimation model are improved. BRIEF DESCRIPTION OF DRAWINGS
[0037] Figure 1 It is a workflow diagram of the application. DETAILED DESCRIPTION
[0038] In order to make the purpose, technical scheme and advantages of the application more clear and explicit, the application will be further described in detail below in combination with the drawings and examples. It should be understood that the specific examples described herein are only used to explain the application and not to limit the application.
[0039] In the description of the application, it should be understood that the orientations or positional relationships indicated by the terms "length", "width", "upper", "lower", "front", "rear", "left", "right", "vertical", "horizontal", "top", "bottom", "inner", "outer" and the like are based on the orientations or positional relationships shown in the drawings, and are only for the convenience of describing the application and simplifying the description, and therefore cannot be understood as indicating or implying that the devices or elements referred to must have a particular orientation, be constructed and operated in a particular orientation, and therefore cannot be understood as limiting the application. In addition, in the description of the application, the meaning of "multiple" is two or more, unless otherwise specifically limited.
[0040] Example one
[0041] Please refer to Figure 1 The application provides a technical solution: an intelligent beef cattle body size measurement method, comprising the following steps:
[0042] S1: Collecting multi-angle images of single beef cattle through a sensor, extracting the pixel distance of the shoulder peak value and the torso baseline in the grid area image, accumulating the horizontal pixel projection width of the image, calculating the pixel gray value difference of the back fat layer, using the lexicographic block reordering algorithm, converting the pixel coordinates of the hoof joint and calculating the angle difference, and generating an identity binding code;
[0043] S2: Based on the identity binding code, receiving the beef cattle body size value and the measurement time field, extracting the current measurement time and comparing it with the writing time in the database with the same code, judging whether it exceeds the writing cooling period, if not, adding it to the writing queue, if it exceeds, performing batch submission, and obtaining a body size measurement storage index;
[0044] S3: Based on the body size measurement storage index, retrieving all measurement records under the same identity code, sorting them in ascending order according to the measurement time field, calculating the difference between the beef cattle body size values of consecutive records, and calculating the length and slope of the consecutive increasing and decreasing intervals to form a body size change sequence feature;
[0045] S4: Based on the body size change sequence feature, constructing a body type category code and a month age scalar combination, and performing local pixel block rendering, using a generative adversarial network to calculate the generated sample pixel difference value, comparing the true and false scores and filtering the threshold, and obtaining a simulation enhanced sample set;
[0046] S5: Based on the simulation enhanced sample set, extracting the beef cattle body size field and the corresponding position code value, calculating the correlation coefficient between each field, filtering out the field pairs below the set threshold, retaining the field pairs for cross combination, and generating a modeling sample pool.
[0047] The identity binding code includes a difference sequence, timestamp information and a hash string, the body size measurement storage index includes the identity binding code, the measurement timestamp and the body size field set, the body size change sequence feature includes the length of the continuous growth interval, the length of the continuous decline interval and the slope change value, the simulation enhanced sample set includes the filtered pixel vector, the error threshold mark and the true and false score, and the modeling sample pool includes the field pair combination, the cross vector set and the field index list.
[0048] The specific steps for generating the identity binding code are as follows:
[0049] Collecting multi-angle images of single beef cattle through a sensor, based on the sensor, dividing the grid area according to the image row and column, scanning each row of gray value to mark the shoulder peak coordinates, searching for the bottom continuous pixel to mark the torso baseline coordinates, calculating the vertical pixel distance between the two points, and generating shoulder pixel distance data;
[0050] Based on the shoulder pixel distance data, the effective pixel label transverse projection width is accumulated in the image column direction, the gray value is extracted by traversing the back region pixel coordinates, the difference between the gray peak value and the valley value is output, and the body gray width data is obtained;
[0051] Based on the body gray width data, the lexicographic block reordering algorithm is used to locate the key pixel points in the hoof region to extract four groups of coordinates, convert the coordinate pairs into vector structures to calculate the angle difference, output the angle floating value and correct the error, and obtain the identity binding code;
[0052] Based on the sensor collecting single-head beef cattle multi-angle images, the image gray processing method is used to convert the collected image format, the image color space transformation module in the image processing tool is used in the conversion process, the input format is specified as three-channel color image, the target format is single-channel gray image, and the image channel extraction operation is performed. After each pixel point is allocated according to the weighted value, the channel mapping is completed, after the gray image is generated, the image block algorithm is used to divide the image into 64 rows and 64 columns of grid areas according to the image two-dimensional matrix row and column index, the size of each grid area is equally distributed according to the original image size, after the division is completed, the gray value set of each row in the image is read row by row, the peak value position in each row of gray value is located by using the maximum value search algorithm, and the transverse pixel coordinates corresponding to the peak value are marked as the shoulder peak horizontal coordinate set. At the same time, the continuous non-zero gray pixels are searched from bottom to top in the lower part of the image, the edge contour extraction method is used to identify the outer contour boundary of the bottom region and extract the lowest point longitudinal pixel value as the trunk baseline longitudinal coordinate, and the difference between the shoulder peak coordinate and the baseline coordinate is calculated. The pixel value difference of the longitudinal axis is generated point by point to generate the shoulder pixel distance data;
[0053] Based on the shoulder pixel distance data, the transverse pixel projection algorithm is used to count the pixels with gray value greater than a fixed threshold in each column of the image, the threshold is set to a fixed integer value 128, the number of pixels higher than the threshold is counted as the projection width value in the column direction, and the transverse width array is formed by accumulating the projection width of all column directions. Then the gray pixel value set is extracted column by column within the range from the shoulder mark position to the baseline region, the local gray fluctuation calculation method is used to traverse each column of gray value set, the maximum value and the minimum value difference operation is performed on the gray set to obtain the gray range value of each column, and finally the column direction is used as the index to combine all the range results. The body gray width data is finally output;
[0054] Based on the body gray scale width data, the dictionary image block reordering algorithm is used to perform sequential positioning on the hoof image area, the upper left corner coordinates of the image block are set as the index key value, the vertical coordinate is used as the primary key, and the horizontal coordinate is used as the secondary key for incremental sorting, four edge blocks at the bottom of the image are obtained as candidate regions after sorting, the maximum gray value position pixels in each candidate region are selected as key points, four sets of key pixel point coordinates are recorded, then two-by-two pairing vector sets are formed, the vector angle difference calculation method is used to calculate the included angle difference of each group of vectors in turn, the floating mean value is calculated by using the mean value regression algorithm after performing the angle difference operation on the whole included angle difference set, and the linear deviation adjustment is performed on the angle difference value, and finally the identity binding code is output.
[0055] The dictionary block reordering algorithm divides the image into fixed-size pixel blocks, extracts the gray vectors of each pixel block, and performs global sorting in dictionary order, and rearranges the image block order according to the sorting result to form a reordered image matrix, which highlights the structural boundary and regional change characteristics;
[0056] The dictionary block reordering algorithm is as follows:
[0057]
[0058] Wherein: Θ' represents the vector included angle value of the hoof region after multi-parameter structure correction, represents the vector composed of the first pair of hoof key pixel point coordinates, represents the vector composed of the second pair of hoof key pixel point coordinates, represents the dot product of vectors and , and represents the Euclidean norm of vector , and represents the Euclidean norm of vector , ω represents the weight coefficient of the dot product item, ΔW represents the body width difference value of the two vector coverage regions, ΔG represents the gray mean difference value of the two vector coverage regions, δ bg represents the gradient average value of the two vector region boundaries, α represents the weight coefficient of the width difference ΔW, β represents the weight coefficient of the gray difference ΔG, and y represents the weight coefficient of the boundary gradient δ bg .
[0059] The execution process is as follows: first, four sets of key pixel point coordinates of the hoof region are extracted and vectors and are constructed, then the dot products and of vectors and their respective norms and are calculated.Then the body width difference AW and the gray mean difference AG are extracted from the corresponding image sub-region, and the average gradient of the region boundary is calculated by the Sobel operator bg Then the dot product term is multiplied by the weight coefficient ω and added to α·AW and β·AG, the denominator is multiplied by the original norm product and added to y·δ bg The corrected angle value Θ is obtained in the inverse cosine function ′ The least square method is used to estimate ω, α, β, y, and the gradient descent method is used to iteratively optimize the mean square error to determine the final coefficient value.
[0060] The specific steps for generating the body size measurement storage index are as follows:
[0061] Based on the identity binding code, the beef cattle body size value and the measurement time field are received, the corresponding value of the measurement time field is extracted, the current system time is synchronized and compared, the time field value in the historical record of the same code is read, the difference between the two time field values is calculated and the difference is judged with the fixed threshold of the cooling period, and the cooling state identifier is generated;
[0062] Based on the cooling state identifier, the record writing mode is determined, the current record buffer state is read and the data writing linked list structure is established, if it is in the cooling state, the data is written to the tail of the linked list and the write cache flag is kept, if it is in the non-cooling state, the data in the linked list is read and written to the database table, then the linked list is emptied, and the body size measurement storage index is obtained;
[0063] Based on the identity binding code, the beef cattle body size value and the measurement time field are received, the measurement time field is processed by a standardized time analysis algorithm, specifically by configuring the time format template as "year-month-day hour: minute: second", and the input time string is segmented and extracted character by character, the six data of year, month, day, hour, minute and second are independently digitized and converted, and then the complete timestamp value is generated by splicing, the system time synchronization algorithm is called to read the current system time as an integer timestamp, the difference between the measurement timestamp and the current system timestamp is calculated by bit-by-bit subtraction, the time difference is generated, then the history record comparison algorithm is called to filter the same code entries from the local historical measurement data and extract the time field, the difference between the current timestamp and the historical timestamp is compared with the fixed cooling period threshold of 3600 seconds, the time interval is determined by setting the Boolean judgment logic whether it is less than the threshold, and the cooling state identifier is outputted;
[0064] Based on the cooling state identification judgment record write mode, the linked list buffer structure generation algorithm is used to construct the data write container, the start node and the tail node are set to empty when initializing the write linked list structure, and the cache enable flag is configured, the current record cache state value is read by calling the buffer state detection module and loaded into the state register, if the current is cooling state, the data write node is constructed by using the chain tail appending method, and connected to the rear of the tail node of the linked list, at the same time, the current buffer write state is marked as "writing", if the current is non-cooling state, the linked list traversal and batch submission algorithm is used to perform node-by-node reading operation from the first node to the tail node of the whole linked list, all data objects in the linked list are copied to the submission buffer queue in turn, the batch write processing is executed to synchronously write the data group to the structured database table, and the linked list memory space is released after the write is completed to empty the cache data, finally, the body size index generation algorithm is called to construct the unique identification value according to the identity code and timestamp information of the data write task, and the body size measurement storage index is generated.
[0065] The specific steps of generating the body size change sequence feature are:
[0066] Based on the body size measurement storage index, all measurement records under the same identity code are retrieved, the measurement time field and the body size value field of each record are extracted, the record order is arranged in ascending order according to the measurement time field, the time ordered sequence is established and the data position information index table is constructed, and the ordered list of measurement records is obtained;
[0067] Based on the ordered list of measurement records, the body size value fields in adjacent records are extracted pair by pair, the difference value between the two value fields is calculated, the difference value interval is judged and the length of the continuous increasing and decreasing interval is accumulated, the first and last measurement time of each interval is extracted and the value difference ratio is calculated as the slope value, and the body size change sequence feature is generated;
[0068] Based on the body size measurement storage index, all measurement records under the same identity code are retrieved, the structured query matching algorithm is used to perform accurate condition filtering operation on the fields in the database table, the instruction form "select all records from the measurement data table, identity code field equal to the current input index value" is constructed, the filtering field is set as the code field, the filter value is set as the code information in the input body size measurement storage index, after the query is executed, multiple structured record data are obtained, the time value comparison operation of the measurement time field in the result record is performed by using the time field ascending order sorting algorithm, the sorting field is set as the measurement time field, and the sequence is rearranged from early to late according to the time field content, the record position mapping relationship is reconstructed after sorting, the data position information index table is constructed, each record corresponds to three contents of record number, physical position pointer and time order index value, and the ordered list of measurement records is generated;
[0069] Based on an ordered list of measurement records, the body size numerical field is extracted from adjacent records one by one. A sliding window difference analysis algorithm is used to perform pairwise calculations on the sequence data. The sliding window step size is set to 1. In each step, two adjacent data points are read as the preceding and following items. The body size numerical fields of the preceding and following items are extracted respectively. The difference result is obtained by subtracting the preceding item from the following item. For each difference, the sign interval classification algorithm is called to perform logical judgment. The judgment condition is that if the difference is greater than zero, it is marked as a positive interval; if it is less than zero, it is marked as a negative interval; if it is equal to zero, it is marked as a stationary interval. At the same time, a counter is set to record the duration of consecutive positive and consecutive negative intervals respectively. Then, the interval boundary identification algorithm is used to record the start index and end index of each consecutive interval. The measurement time field corresponding to the beginning and end of each interval is extracted in sequence. The time span value is formed by the difference of the time field. The corresponding body size numerical fields at the beginning and end are extracted to form the numerical span value. The two span values are divided to form the slope value. All result sequences are stored in interval order to finally generate the body size change sequence features.
[0070] The specific steps for generating the simulation enhancement sample set are as follows:
[0071] Based on the characteristics of body size change sequence, a combination field of body type category code and monthly age scalar is constructed. The combination field is arranged to generate input row data. Field paragraphs are separated and the position of each field is marked. The format is converted into a standard row and column form input condition module to generate a set of condition input fields.
[0072] Based on the conditional input field set, a generative adversarial network is used to locate the original information block of the image by field index, read the pixel partition within the index range to perform rendering operation, compare the rendered pixel value with the original value to form a difference list, and obtain the local pixel difference sequence.
[0073] Based on the local pixel difference sequence, all pixel blocks that exceed the set range are filtered out, the effective pixel vectors are integrated according to the index sequence and the sequence order is rearranged, and the complete mapping structure is output as an image sample set to obtain the simulation enhancement sample.
[0074] The body size category code and the age scalar are combined to form a field based on the sequence characteristics of the body size changes, a field combination algorithm is used to perform field combination operation, the body size category code is set as a group of three fixed-length character data, the age scalar is set as a group of two integer value data, the above two fields are arranged and combined to form a six-bit composite combination field, then the format of each combination field is processed, the field values are written in order in the row structure, a fixed separator symbol "|" is used to mark the logical paragraphs of the fields, a field position marking algorithm is called to set the start and end positions of each field and build a position index table, a structure conversion operation is performed to convert all field combinations into a unified two-dimensional array form, each row represents an independent field dimension, and finally the standardized two-dimensional array is input into the data receiving channel of the condition module to generate a condition input field set;
[0075] Based on the condition input field set, a generative adversarial network method is used to perform image simulation processing, a standard adversarial network composed of a discriminator and a generator is selected, the body size code and the age information in the field set are received as a condition vector at the input end, the field numbers are decoded one by one in combination with the vector input index table, and the original image information block is located in the image data index matrix according to the decoding result, the starting row and column coordinates and the range length in the index matrix are set, the pixel value set corresponding to the range in the image matrix is read, then a local reconstruction operation is performed by calling an image rendering module, the rendering method is to adjust the image texture brightness and the regional channel color ratio according to the condition vector, the rendered pixel data and the original pixel data are compared point by point, the numerical difference in the pixel intensity channel is calculated and arranged in a matrix structure for output, and a local pixel difference sequence is obtained;
[0076] Based on the local pixel difference sequence, a pixel interval screening algorithm is used to set the upper limit of the difference range to 64 and the lower limit to -64, interval judgment operation is performed on each pixel difference value, all pixel block data with a difference value outside the range are removed, and all pixel groups within the limited range are retained, a pixel index reordering method is called, an initial pixel position index is used as a primary key field to build a reordering index table, valid pixel values are combined into a continuous pixel vector in the reordering index order, and the index and vector content are used to build a complete two-dimensional structure mapping diagram, all pixel mapping structures are integrated and output to generate an image sample set, and finally a simulation enhanced sample is obtained;
[0077] The generative adversarial network first maps the conditional input field set to a conditional vector, and combines the field index to locate the corresponding image original information block, generates a network taking the conditional vector as input, and performs pixel rendering operation on the selected pixel partition, then the discriminant network receives the rendered pixel block and the original pixel block in parallel, extracts features through the convolution layer and the full connection layer, and calculates the true and false score, finally under the driving of the discriminant error back propagation, the generative network and the discriminant network alternately update the parameters, and the pixel-by-pixel difference list between the rendered pixel value and the original value is the local pixel difference sequence;
[0078] The generative adversarial network is generated according to the formula:
[0079]
[0080] Wherein: E represents the comprehensive error value of local pixel difference, M represents the total number of pixels, p i represents the i-th pixel weight coefficient generated by the conditional field index, g i represents the pixel value of the i-th pixel in the rendered image of the generative adversarial network, u i represents the pixel value of the i-th pixel in the original image, U represents the local spatial consistency penalty term of the image block, V represents the image block perceptual contrast difference term, W represents the time smoothing penalty term of the image block in the multi-frame sequence, X represents the normalized area factor, λ1 represents the weight coefficient of the spatial consistency penalty term U, λ2 represents the weight coefficient of the perceptual contrast difference term V, λ3 represents the weight coefficient of the time smoothing penalty term W, and λ4 represents the weight coefficient of the normalized area factor X.
[0081] The execution process is as follows: first, based on the conditional input field set, the target region is located in the image and the original pixel block under the corresponding index is extracted, then the generative adversarial network is used to perform pixel-level reconstruction on the region to generate a rendered image and extract the rendered pixel value g i , and the original pixel value u i , according to the field structure to generate the corresponding weight coefficient p i , which is used for weighted error calculation, at the same time, the spatial consistency constraint is established in the image sub-block to calculate the local smoothing term U, the brightness and edge contrast features are extracted in the perceptual space to obtain the perceptual difference term V, the pixel stability is compared in the continuous image frames to obtain the time smoothing term W, and the corresponding area is counted to extract the normalized term X, finally U, V, W, X are weighted according to the preset coefficients λ1, λ2, λ3, λ4, and the original error weighted term is combined to form the improved formula, and the E value is taken as the image difference degree measurement index to reflect the local structure distortion degree.
[0082] The specific steps of generating the modeling sample pool are as follows:
[0083] Based on the simulation enhanced sample set, the beef cattle body size field value and the corresponding position code value are extracted, the sample entries are read in batches, and a double column value list is generated, the value difference of each column is calculated in turn and accumulated, the ratio is calculated and the difference is counted, and the inter-field correlation coefficient table is generated;
[0084] Based on the inter-field correlation coefficient table, all field pairs below the set value threshold are screened out, the remaining field pair indexes are extracted and a matching list is established, the matching list is traversed to perform two-way permutation combination of field values and merge the value vectors, and the list is de-duplicated and merged to generate a modeling sample pool.
[0085] Based on the simulation enhanced sample set, the batch field extraction algorithm is used to call the query instruction "extract body size value field and position code field from the simulation sample table", the query condition is specified as the sample set identifier value, all sample entries are read in batches, and the body size value column and the position code column are stored in two value lists respectively. By using the difference calculation loop processing method, the corresponding element pairs of the two lists are taken out in turn through the index loop structure to perform subtraction operation and the results are appended to the difference list. By using the accumulation summation operation, the aggregation instruction "perform accumulation operation on all elements in the difference list" is called to get the total difference value. By using the ratio calculation method, the average difference ratio is calculated by using the ratio formula "total difference value divided by sample entry number". By using the difference statistical algorithm, the maximum value, the minimum value and the mean value of the difference list are calculated respectively through the index loop. Each statistical quantity is organized into a matrix form according to the field pair, and the inter-field correlation coefficient table is generated.
[0086] Based on the inter-field correlation coefficient table, the threshold exclusion algorithm is used to traverse and judge the correlation values of each field pair, all field pairs with correlation values less than the threshold value 0.75 are excluded and the remaining field pair indexes are recorded. The remaining indexes are written into the matching list structure in turn by using the matching list generation method. The two-way permutation combination algorithm is called to perform two-way permutation operation on the field values of each field pair in the matching list and merge the permuted vectors into a new value vector. By using the list de-duplication processing method, the repeated vectors are excluded by performing item-by-item comparison in the merged result list. By using the merge aggregation algorithm, all unique vectors are spliced to build a unified data structure according to the pre-defined column order, and the modeling sample pool is generated.
[0087] A beef cattle body size intelligent measurement device, comprising a memory and a processor, the memory stores a computer program, and the processor executes the computer program to realize the steps of the above-mentioned beef cattle body size intelligent measurement method.
[0088] The above merely describes the preferred embodiments of the present application, and is not intended to limit the present application in other forms. Any skilled person in the art can modify or change the disclosed technical content into equivalent embodiments with equivalent changes, and apply them to other fields. However, any simple modification, equivalent change and modification made to the above embodiments according to the technical essence of the present application, without departing from the technical solution content of the present application, still falls within the protection scope of the present application.
Claims
1. A method for intelligent determination of beef cattle body dimensions, characterized in that, The method comprises the following steps: S1: Collecting multi-angle images of single beef cattle through a sensor, extracting the pixel distance of the shoulder peak value and the trunk baseline in the grid area image, accumulating the lateral pixel projection width, calculating the pixel gray value difference of the back fat layer, using the lexicographic block reordering algorithm, converting the pixel coordinates of the hoof joint and calculating the angle difference, and generating an identity binding code; S2: Based on the identity binding code, receiving the beef cattle body size value and the measurement time field, extracting the current measurement time and comparing it with the writing time in the database with the same code, judging whether it exceeds the writing cooling period, if not, adding it to the writing queue, if it exceeds, performing batch submission, and obtaining a body size measurement storage index; S3: Based on the body size measurement storage index, retrieving all measurement records under the same identity code, sorting in ascending order according to the measurement time field, calculating the beef cattle body size value difference between consecutive records, and calculating the length and slope of the consecutive increasing and decreasing intervals to form a body size change sequence feature; S4: Based on the body size change sequence feature, constructing a body type category code and a month age scalar combination, and performing local pixel block rendering, using a generative adversarial network to calculate the generated sample pixel difference, comparing the true and false scores and filtering the threshold, and obtaining a simulation enhanced sample set; S5: Based on the simulation enhanced sample set, extracting the beef cattle body size field and the corresponding position code value, calculating the correlation coefficient between each field, filtering out field pairs below the set threshold, retaining the field pairs for cross combination, and generating a modeling sample pool.
2. The method of claim 1, wherein the method is characterized by, The identity binding code includes a difference sequence, timestamp information, and a hash string. The body size measurement storage index includes an identity binding code, a measurement timestamp, and a body size field set. The body size change sequence feature includes a continuous growth interval length, a continuous decline interval length, and a slope change value. The simulation enhanced sample set includes a filtered pixel vector, an error threshold label, and a true and false score. The modeling sample pool includes a field pair combination, a cross vector set, and a field index list.
3. The method of claim 1, wherein the method is characterized by, The specific steps for generating the identity binding code are as follows: Collecting multi-angle images of single beef cattle through a sensor, based on the sensor, dividing the grid area according to the image row and column, scanning each row of gray value to mark the shoulder peak coordinates, searching for the bottom continuous pixel to mark the trunk baseline coordinates, calculating the vertical pixel distance between the two points, and generating shoulder pixel distance data; Based on the shoulder pixel distance data, accumulating the effective pixel mark lateral projection width in each column according to the image column direction, traversing the back area pixel coordinates to extract the gray value, outputting the difference value of the gray peak and valley, and obtaining the body type gray width data; Based on the body type gray width data, using the lexicographic block reordering algorithm, positioning the key pixel points in the hoof area to extract four groups of coordinates, converting the coordinate pairs to form a vector structure to calculate the included angle difference, outputting the angle floating value and correcting the error, and obtaining the identity binding code.
4. The method of claim 3, wherein the method is characterized by, The lexicographic block reordering algorithm divides the image into fixed-size pixel blocks, extracts the gray vector of each pixel block, and performs global sorting according to the lexicographic order. According to the sorting result, the image block order is rearranged to form a reordered image matrix, which highlights the structural boundary and regional change characteristics.
5. The method of claim 1, wherein the method is characterized by, The specific steps for generating the body size measurement storage index are: Based on the identity binding code, the beef cattle body size value and the measurement time field are received, the value corresponding to the measurement time field is extracted, the current system time is synchronized and compared, the time field value in the historical record of the same code is read, the difference between the two time field values is calculated, and the difference is judged with the fixed threshold of the cooling period to generate a cooling state identifier; Based on the cooling state identifier judgment record writing mode, the current record buffer state is read and the data writing linked list structure is established, if in the cooling state, the data is written to the tail of the linked list and the write cache mark is kept, if in the non-cooling state, the data in the linked list is read and written to the database table, and then the linked list is emptied, and the body size measurement storage index is obtained.
6. The method of claim 1, wherein the method is characterized by, The specific steps for generating the body size change sequence feature are: Based on the body size measurement storage index, all measurement records under the same identity code are retrieved, the measurement time field and the body size value field of each record are extracted, the record order is arranged in ascending order according to the measurement time field, the time-ordered sequence is established, and the data position information index table is constructed, and the ordered list of measurement records is obtained; Based on the ordered list of measurement records, the body size value fields in adjacent records are extracted pair by pair, the difference between the two value fields is calculated, the difference interval is judged, and the length of the continuous increasing and decreasing interval is accumulated, the first and last measurement times of each interval are extracted, and the value difference ratio is calculated as the slope value, and the body size change sequence feature is generated.
7. The method of claim 1, wherein the method is characterized by, The specific steps for generating the simulation enhanced sample set are: Based on the body size change sequence feature, the body type category code and the month age scalar combined field are constructed, the input row data is generated by arranging the combined field, the field paragraphs are separated and the positions of each field are marked, the format is converted to the standard row-column form, the condition module is input, and the condition input field set is generated; Based on the condition input field set, a generative adversarial network is used to locate the image original information block according to the field index, read the pixel partition in the index range to perform rendering operation, compare the rendered pixel value with the original value to form a difference list, and obtain the local pixel difference sequence; Based on the local pixel difference sequence, all pixel blocks exceeding the set range are filtered out, the effective pixel vector is integrated and reordered in sequence according to the index sequence, the complete mapping structure is output as the image sample set, and the simulation enhanced sample set is obtained.
8. The method of claim 7, wherein the method is characterized by, The generative adversarial network first maps the condition input field set to a condition vector, combines the field index to locate the corresponding image original information block, generates a network with the condition vector as input, performs pixel rendering operation on the selected pixel partition, then discriminates the network and receives the rendered pixel block and the original pixel block in parallel, extracts features through convolution layer and full connection layer and calculates the authenticity score, finally under the driving of the reverse propagation of the discrimination error, the network and the discriminant network are alternately updated, and the pixel-by-pixel difference list between the rendered pixel value and the original value is the local pixel difference sequence.
9. The method of claim 1, wherein the method is characterized by, The specific steps for generating the modeling sample pool are: Based on the simulation enhanced sample set, the beef cattle body size field value and the corresponding position code value are extracted, the sample entries are read in batches to generate a double-column value list, the value difference of each column is calculated in turn and the sum is accumulated, the ratio is calculated and the difference is counted, and the inter-field correlation coefficient table is generated; Based on the inter-field correlation coefficient table, all field pairs below the set value threshold are excluded, the remaining field pair indexes are extracted and a matching list is established, the matching list is traversed to perform bidirectional arrangement combination of field values and merge the value vectors, and the list is de-duplicated and merged to generate the modeling sample pool.
10. A beef cattle body dimension intelligent measuring device, comprising a memory and a processor, characterized in that, The memory stores a computer program, and the processor executes the computer program to realize the steps of the beef cattle body size intelligent measurement method in any one of claims 1 to 9.
Citation Information
Cited By
Beef cattle body length non-contact accurate measurement method in channel fence passing scene
CN122062574A