Ear identification and channel optimization-based piglet counting and tracing method and system
Patent Information
- Application Number
- CN202610996283.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-07-06
- Publication Date
- 2026-08-18
AI Technical Summary
[0004]本发明的目的在于解决上述背景技术中提到的现有系统通常依据耳标读取时间间隔对重复读取结果进行合并或去重,造成耳标身份与实际通过行为、称重数据、通道信息或装车去向之间发生错配的问题,而提出基于耳标识别与通道优化的育猪出栏计数溯源方法及系统
本发明提出了基于耳标识别与通道优化的育猪出栏计数溯源方法及系统,通过在出栏过程中同时获取耳标读取信息和通道运行信息,不再仅依据耳标读取时间间隔对重复读取结果进行简单合并或去重,而是进一步结合耳标在出栏通道中的出现状态以及通道控制过程,判断同一耳标的多次间断出现是否由缓冲门、限位门、节拍门或分流门等通道控制过程引起,并据此判断当前耳标去重时间是否适用于当前出栏通行状态;当当前耳标去重时间不适用时,基于同一耳标的非连续出现情况以及相邻不同耳标的连续出现情况重新确定耳标去重时间,再依据重新确定的耳标去重时间对耳标读取信息进行合并或区分,从而能够避免因去重时间过短而将同一育肥猪探入、停顿、后退、再次进入识别区域所形成的多次读取误判为多次有效通过,也能够避免因去重时间过长而将前后相邻育肥猪的耳标读取结果错误合并;同时,通过将重新生成的出栏通过记录与通道出口信息、称重信息和装车去向信息进行对应绑定,能够降低耳标身份与实际通过行为、称重数据、通道信息及装车去向之间发生错配的风险,使出栏计数结果不仅能够反映读取到的耳标数量,还能够更准确地对应育肥猪真实通过过程和后续溯源关系,从而提高育肥猪出栏计数的准确性、出栏记录的可靠性以及溯源信息的完整性。
Smart Images

Figure CN122597104A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of counting and traceability technology, specifically to a method and system for counting and tracing pigs at market age based on ear tag recognition and channel optimization. Background Technology
[0002] In the management of fattening pigs at large-scale pig farms, to improve the accuracy of slaughter counting and individual traceability, a slaughter counting and traceability method combining ear tag recognition and channel optimization is usually adopted. Specifically, the farm pre-attaches each fattening pig with an electronic ear tag with a unique identification number, and binds the ear tag number to the pig's pen, breeding batch, growth record, immunization record, medication record, weight information, and planned slaughter task in the management system. During slaughter operations, a list of pigs to be slaughtered is first generated according to the slaughter plan, and then the pigs are guided through the ear tag recognition area in sequence through structures such as buffer zones, limit gates, single-row channels, identification channels, weighing channels, and diversion channels. The system reads the ear tag number of a pig as it passes through the identification area and compares the result with the list of pigs to be slaughtered to determine if the pig belongs to the current slaughter target. Simultaneously, it combines information such as passage time, channel number, weighing data, and vehicle destination to form a slaughter record, thereby achieving automatic counting of slaughtered pigs, confirmation of individual pig identities, and traceability management for subsequent transportation, slaughter, or sales. Through this method, problems such as manual counting errors, mixed pen populations, duplicate registrations, and gaps in slaughter information can be reduced to a certain extent, improving the level of digital management in the fattening pig slaughtering process.
[0003] However, in actual slaughtering processes, while optimized passageway structures can reduce the risk of pig congestion and side-by-side walking, the buffer gates, limit gates, rhythmic gates, or diversion gates they design can also alter the pigs' originally continuous natural passage. When fattening pigs are affected by factors such as gate opening and closing, being driven by personnel, being squeezed by other pigs behind them, and unfamiliar environmental stimuli, they are prone to exhibiting discontinuous behaviors such as probing, pausing, retreating, and re-entering before and after the ear tag recognition area. This causes the actual slaughtering action of the same pig to be split into multiple discontinuous recognition segments. Existing systems typically merge or deduplicate repeated ear tag readings based on the ear tag reading time interval. However, in the aforementioned rhythmic passage scenario, if the time interval is set too short, it may misjudge multiple entries of the same pig into the recognition area as multiple valid passages; if the time interval is set too long, it may incorrectly merge the recognition segments of adjacent pigs, or even cause mismatches between ear tag identification and actual passage behavior, weighing data, passageway information, or loading destination. Summary of the Invention
[0004] The purpose of this invention is to solve the problem mentioned in the background art that existing systems usually merge or deduplicate repeated reading results based on the ear tag reading time interval, which causes mismatch between ear tag identity and actual passing behavior, weighing data, channel information or loading destination. Therefore, this invention proposes a pig slaughter counting and traceability method and system based on ear tag recognition and channel optimization.
[0005] A first aspect of this invention provides a method for tracing and counting piglets at market age based on ear tag recognition and channel optimization, the method comprising: Acquire ear tag reading information and channel operation information generated during the fattening pig slaughter process, and determine the ear tag appearance status of each fattening pig in the slaughter channel based on the ear tag reading information; Based on the ear tag appearance status and channel operation information, determine whether the same ear tag has a discontinuous appearance caused by the channel control process, and determine whether the current ear tag deduplication time is applicable to the current exit passage status; When it is determined that the current deduplication time for ear tags is not applicable to the current exit passage status, the deduplication time for ear tags is re-determined based on the non-continuous occurrence of the same ear tag and the continuous occurrence of adjacent different ear tags. Based on the redefined ear tag deduplication time, the ear tag reading information is merged or distinguished to generate a slaughter passage record. Combined with channel exit information, weighing information, and loading destination information, the traceability result of fattening pig slaughter count is obtained.
[0006] Optionally, the steps for determining whether the same ear tag exhibits discontinuous occurrences due to the channel control process, and for determining whether the current ear tag deduplication time is applicable to the current exit passage status, are as follows: Arrange the records of multiple appearances of the same ear tag during the breeding process in chronological order, and extract the interruption time between two adjacent appearance records; The interruption time is compared with the closing time and reopening time of the buffer door, limit door, or diversion door; When the interruption time falls at least partially between the closing time and reopening time of the buffer gate, limit gate, or diversion gate, and the ear tag numbers corresponding to two adjacent occurrences are the same, and there is no channel exit trigger result and weighing result corresponding to the ear tag between the two occurrences, the two adjacent occurrences are determined to be non-continuous occurrences formed by the same fattening pig under the channel control process. Extract the interrupt time corresponding to each non-continuous occurrence and determine the maximum interrupt time in the set of non-continuous occurrence times; Extract the time interval between the occurrence records of adjacent different ear tags, and when there are independent channel exit trigger results and independent weighing results between adjacent different ear tags, determine the time interval as the continuous passage interval of different fattening pigs, and then determine the minimum time interval in the set of continuous passage intervals. The current ear tag deduplication time is compared with the maximum interruption time and the minimum time interval. Based on the comparison results, it is determined whether the current ear tag deduplication time is applicable to the current exit passage status.
[0007] Optionally, the step of determining whether the current ear tag deduplication time is applicable to the current exit passage status based on the comparison results is as follows: When the current ear tag deduplication time is less than the maximum interruption time, it is determined that the current ear tag deduplication time is not applicable to the current exit passage status. When the current ear tag deduplication time is greater than the minimum time interval, it is determined that the current ear tag deduplication time is not applicable to the current exit passage status; When the current ear tag deduplication time is not less than the maximum interruption time and not greater than the minimum time interval, it is determined that the current ear tag deduplication time is applicable to the current exit passage status.
[0008] Optionally, based on the non-contiguous occurrence of the same ear tag and the consecutive occurrence of adjacent different ear tags, the step of redetermining the ear tag deduplication time is as follows: Extract the interruption times corresponding to the non-continuous occurrences of each ear tag to form a set of non-continuous occurrence times; Extract the time intervals corresponding to the consecutive occurrences of adjacent different ear tags to form a set of consecutive occurrence times; Determine the maximum interruption time in the set of discontinuous occurrence times and the minimum time interval in the set of continuous occurrence times; When the maximum interruption time is less than the minimum time interval, the time value between the maximum interruption time and the minimum time interval is determined as the candidate deduplication time; Calculate the number of identical earmark merging errors and different earmark merging errors corresponding to each candidate deduplication time, and determine the candidate deduplication time with the smallest sum of identical earmark merging errors and different earmark merging errors as the re-determined earmark deduplication time.
[0009] Optionally, the number of errors in merging the same ear tag is: the number of times the interruption time between two adjacent occurrences of the same ear tag is greater than the candidate deduplication time; The number of errors in merging different ear tags is defined as the number of times when the time interval between consecutive occurrences of adjacent different ear tags is no greater than the candidate deduplication time. When the maximum interruption time is not less than the minimum time interval, determine that there is no valid time interval in the current exit channel that can be used to reset the ear tag deduplication time, and output the result that the ear tag deduplication time cannot be reset.
[0010] Optionally, the output ear tag deduplication time cannot be reset, including: Control the buffer gate, limit gate or diversion gate to enter the flow restriction release state, so as to increase the release time interval between adjacent fattening pigs; Under the flow control and release status, re-collect subsequent ear tag reading information, channel exit trigger results, and weighing results; Based on the re-acquired ear tag reading information, channel exit trigger results, and weighing results, the interruption time corresponding to the non-continuous appearance of the same ear tag and the time interval corresponding to the continuous appearance of adjacent different ear tags are re-extracted. When the maximum interruption time after re-extraction is less than the minimum time interval after re-extraction, the ear tag deduplication time is re-determined, and the exit pass record is generated based on the re-determined ear tag deduplication time. When the maximum interruption time after re-extraction is not less than the minimum time interval after re-extraction, the corresponding ear tag appearance record is identified as an abnormal slaughter record, and the fattening pigs corresponding to the abnormal slaughter record are imported into the review channel for single-pig review.
[0011] Optionally, the steps to obtain the traceability results of fattening pig slaughter counts are as follows: Arrange the records of each occurrence of the same ear tag in chronological order, and compare the time interval between two adjacent occurrences with the newly determined deduplication time of the ear tag.
[0012] When the time interval is greater than the redetermined deduplication time for ear tags, two adjacent occurrences are distinguished as two independent candidate passes; when the time interval is not greater than the redetermined deduplication time for ear tags, two adjacent occurrences are merged into one candidate pass.
[0013] For each candidate, its start and end reading times are determined by recording, and the channel exit trigger result is matched within the first preset time window after the end reading time.
[0014] After matching the output result, the weighing result is matched again within the second preset time window after the trigger time corresponding to the output result.
[0015] After matching the weighing result, the loading destination result is matched again within the third preset time window after the time corresponding to the weighing result.
[0016] When a candidate pass record is matched sequentially with the exit result, weighing result, and loading destination result, it is determined as a valid exit pass record, and the ear tag number, start reading time, end reading time, exit result, weighing result, and loading destination result are bound.
[0017] If no matching result is found within any preset time window, the candidate record will be identified as an abnormal outgoing record.
[0018] The system accumulates the count of each valid pig slaughter through records, and outputs the corresponding exit result, weighing result, and loading destination result according to the ear tag number, generating traceability results for fattening pig slaughter count.
[0019] A second aspect of this invention provides a piglet counting and traceability system based on ear tag recognition and channel optimization, the system comprising: Information module: Acquires ear tag reading information and channel operation information generated during the fattening pig slaughter process, and determines the ear tag appearance status of each fattening pig in the slaughter channel based on the ear tag reading information; Passage Status Module: Based on the ear tag appearance status and channel operation information, determine whether the same ear tag has a discontinuous appearance caused by the channel control process, and determine whether the current ear tag deduplication time is applicable to the current exit passage status; Deduplication Time Module: When it is determined that the current deduplication time for ear tags is not applicable to the current exit passage status, the deduplication time for ear tags is re-determined based on the non-continuous occurrence of the same ear tag and the continuous occurrence of adjacent different ear tags; The traceability results module merges or distinguishes ear tag reading information based on the redefined ear tag deduplication time, generates a slaughter passage record, and combines it with channel exit information, weighing information, and loading destination information to obtain the traceability results for fattening pig slaughter count. The beneficial effects of this invention are: This invention proposes a method and system for tracing pig slaughter counts based on ear tag recognition and channel optimization. By simultaneously acquiring ear tag reading information and channel operation information during the slaughtering process, it goes beyond simply merging or deduplicating repeated readings based on ear tag reading time intervals. Instead, it further combines the appearance status of ear tags in the slaughtering channel with the channel control process to determine whether the multiple intermittent appearances of the same ear tag are caused by channel control processes such as buffer gates, limit gates, rhythm gates, or diversion gates. Based on this, it determines whether the current ear tag deduplication time is applicable to the current slaughtering passage status. When the current ear tag deduplication time is not applicable, the ear tag deduplication time is re-determined based on the non-continuous appearance of the same ear tag and the continuous appearance of adjacent different ear tags. The ear tag reading information is then processed according to the re-determined ear tag deduplication time. By merging or differentiating ear tags, the system avoids misjudging multiple reads of the same fattening pig entering, pausing, retreating, and re-entering the identification area due to insufficient deduplication time, and also avoids incorrectly merging ear tag reads of adjacent fattening pigs due to excessive deduplication time. Furthermore, by binding the newly generated exit records with channel exit information, weighing information, and loading destination information, the system reduces the risk of mismatches between ear tag identity and actual passing behavior, weighing data, channel information, and loading destination. This ensures that the exit count not only reflects the number of ear tags read but also more accurately corresponds to the actual passing process of the fattening pigs and subsequent traceability, thereby improving the accuracy of fattening pig exit counts, the reliability of exit records, and the completeness of traceability information. Attached Figure Description
[0020] Figure 1 The flowchart illustrates the pig slaughter counting and traceability method based on ear tag recognition and channel optimization provided in this embodiment of the invention. Detailed Implementation
[0021] To further illustrate the technical means and effects of the present invention in achieving its intended purpose, the following detailed description of the specific implementation methods, structures, features, and effects of the present invention, in conjunction with the accompanying drawings and preferred embodiments, is provided below.
[0022] This invention provides a method for tracing and counting piglets at market age based on ear tag recognition and channel optimization. See also... Figure 1 The method includes the following steps: S1: Obtain ear tag reading information and channel operation information generated during the fattening pig slaughter process, and determine the ear tag appearance status of each fattening pig in the slaughter channel based on the ear tag reading information; S2: Based on the ear tag appearance status and channel operation information, determine whether the same ear tag has a discontinuous appearance caused by the channel control process, and determine whether the current ear tag deduplication time is applicable to the current exit passage status; S3: When it is determined that the current deduplication time for ear tags is not applicable to the current exit passage status, the deduplication time for ear tags is re-determined based on the non-continuous occurrence of the same ear tag and the continuous occurrence of adjacent different ear tags; S4: Based on the redefined ear tag deduplication time, merge or distinguish the ear tag reading information, generate a slaughter passage record, and combine it with channel exit information, weighing information and loading destination information to obtain the fattening pig slaughter count traceability result.
[0023] In one embodiment, S1: Obtain ear tag reading information and channel operation information generated during the fattening pig slaughtering process, and determine the ear tag appearance status of each fattening pig in the slaughtering channel based on the ear tag reading information, specifically: Ear tag reading devices are installed in the ear tag recognition area of the fattening pig exit channel. Status acquisition devices are installed at the channel entrance, exit, weighing position, and buffer gate, limit gate, or diversion gate. When fattening pigs pass through the exit channel, the ear tag reading devices collect the ear tag number, reading start time, reading end time, reading duration, and identification position to form ear tag reading information. At the same time, the status acquisition devices collect the opening and closing times of the buffer gate, limit gate, or diversion gate, the trigger time of the channel entrance, the trigger time of the channel exit, and the trigger time of the weighing equipment to form channel operation information. Then, the ear tag reading information is sorted in chronological order. Records of the same ear tag being read continuously during the exit process are merged into a single occurrence record. Records of the same ear tag being read again after a reading interruption are marked as intermittent occurrence records. The occurrence time relationship between adjacent different ear tags is also recorded, thereby determining the ear tag occurrence status of each fattening pig in the exit channel.
[0024] Specifically, in the fattening pig exit channel, the ear tag recognition area, entrance detection position, exit detection position, weighing position, and control positions of each channel are first determined based on the actual path the pigs take. Ear tag reading devices are installed in the ear tag recognition area, and status acquisition devices are set up at the channel entrance, exit, weighing position, and buffer gates, limit gates, or diversion gates to simultaneously monitor both "ear tag reading status" and "the on-site status of the pigs passing through the channel." Once the fattening pigs enter the exit channel, the ear tag reading device continuously reads the electronic ear tags worn by the pigs. It doesn't just record whether a particular ear tag is read, but also records when the ear tag number begins to be read, when the reading ends, and the duration of each reading. The reading result originates from a specific identification location. For example, if ear tag A001 is read by the entrance-side antenna at 10:00:01 and reading is interrupted at 10:00:04, it indicates that A001 has entered or approached the identification area, but it cannot be directly concluded that it has completed the passage. Simultaneously, the status acquisition device synchronously collects channel operation information, such as the buffer gate opening at 10:00:00, the limit gate closing at 10:00:03, the limit gate reopening at 10:00:07, the channel entrance being triggered at 10:00:01, the channel exit being triggered at 10:00:11, and the weighing equipment generating a weight signal at 10:00:10. This information allows us to determine the channel environment and gate location of the pig when the ear tag is read. The system then monitors the pig's body control status. Subsequently, the ear tag reading information is organized chronologically, merging records of the same ear tag being continuously read within a specific timeframe into a single occurrence record. For example, if A001 is continuously read from 10:00:01 to 10:00:04, this constitutes a single occurrence record for A001. If the same ear tag is read again after a reading interruption, it is not directly counted as two separate exits. Instead, it is marked as an intermittent occurrence record. For example, if A001 is read from 10:00:01 to 10:00:04 and then disappears, but is read again from 10:00:08 to 10:00:12, this is recorded as an intermittent occurrence state for A001. This state may correspond to the same pig being affected by a closed gate or other factors. The system records the "enter-exit-re-enter" behavior of pigs that occur when they are startled and retreat or wait for permission to pass. It also records the temporal relationship between different ear tags. For example, if A001 disappears at 10:00:12 and B002 appears at 10:00:13, it indicates that the two pigs may pass close together. Similarly, if A001 and B002 are read simultaneously between 10:00:09 and 10:00:11, it suggests possible crowding, parallel passage, or pressure from one another. Through this process, the system ultimately determines the ear tag appearance status of each fattening pig in the exit passage. This status indicates not only whether a particular ear tag has been read, but also whether it appears continuously, intermittently, briefly, adjacent to other ear tags, or overlapping with other ear tags.
[0025] In one embodiment, S2: The step of determining whether the same ear tag has a discontinuous appearance caused by the channel control process based on the ear tag appearance status and channel operation information, and determining whether the current ear tag deduplication time is applicable to the current exit passage status, is as follows: Arrange the records of multiple appearances of the same ear tag during the breeding process in chronological order, and extract the interruption time between two adjacent appearance records; The interruption time is compared with the closing time and reopening time of the buffer door, limit door, or diversion door; When the interruption time falls at least partially between the closing time and reopening time of the buffer gate, limit gate, or diversion gate, and the ear tag numbers corresponding to two adjacent occurrences are the same, and there is no channel exit trigger result and weighing result corresponding to the ear tag between the two occurrences, the two adjacent occurrences are determined to be non-continuous occurrences formed by the same fattening pig under the channel control process. Extract the interrupt time corresponding to each non-continuous occurrence and determine the maximum interrupt time in the set of non-continuous occurrence times; Extract the time interval between the occurrence records of adjacent different ear tags, and when there are independent channel exit trigger results and independent weighing results between adjacent different ear tags, determine the time interval as the continuous passage interval of different fattening pigs, and then determine the minimum time interval in the set of continuous passage intervals. The current ear tag deduplication time is compared with the maximum interruption time and the minimum time interval. Based on the comparison results, it is determined whether the current ear tag deduplication time is applicable to the current exit passage status.
[0026] In one implementation, the step of determining whether the current ear tag deduplication time is applicable to the current exit passage status based on the comparison results is as follows: When the current ear tag deduplication time is less than the maximum interruption time, it is determined that the current ear tag deduplication time is not applicable to the current exit passage status. When the current ear tag deduplication time is greater than the minimum time interval, it is determined that the current ear tag deduplication time is not applicable to the current exit passage status; When the current ear tag deduplication time is not less than the maximum interruption time and not greater than the minimum time interval, it is determined that the current ear tag deduplication time is applicable to the current exit passage status.
[0027] It should be noted that the records of multiple appearances of the same ear tag during the slaughtering process are first arranged chronologically, and the interruption time between two adjacent appearances is extracted. Then, this interruption time is compared with the closing and reopening times of the buffer gate, limit gate, or diversion gate. If the interruption time falls at least partially within the time interval between the gate closing and reopening, and there is no corresponding channel exit trigger result or weighing result between the two adjacent appearances, it can be determined that the two adjacent appearances are not two independent passages, but rather discontinuous appearances caused by the same fattening pig being affected by the channel control process. For example, after the same ear tag appears for the first time, the limit gate closes, causing the pig to stop or retreat. After the limit gate reopens, the ear tag appears again, and there is no exit trigger or weighing result between the two appearances. This indicates that the two appearances of the ear tag belong to one interrupted passage process of the same pig. Based on this, the interruption time corresponding to each non-continuous occurrence is extracted, and the maximum interruption time is determined. Simultaneously, the time interval between adjacent different ear tags is extracted, and when these adjacent different ear tags correspond to independent exit trigger results and independent weighing results, this time interval is determined as the continuous passage interval for different fattening pigs, thus determining the minimum time interval. Finally, the current ear tag deduplication time is compared with the maximum interruption time and the minimum time interval: when the current ear tag deduplication time is less than the maximum interruption time, it indicates that the deduplication time is too short, which may misjudge non-continuous occurrences of the same pig as multiple passages; when the current ear tag deduplication time is greater than the minimum time interval, it indicates that the deduplication time is too long, which may mistakenly merge the continuous passages of adjacent different fattening pigs; only when the current ear tag deduplication time is not less than the maximum interruption time and not greater than the minimum time interval can it be determined that the current ear tag deduplication time is applicable to the current exit passage status. For example, if ear tag A001 is read between 10:00:01 and 10:00:03, then disappears between 10:00:03 and 10:00:07, and is read again between 10:00:07 and 10:00:10; simultaneously, the stop gate closes at 10:00:03 and reopens at 10:00:07, and there are no exit trigger results or weighing results between these two reads, then it can be determined that the two appearances of A001 are non-continuous appearances caused by the same pig stopping, retreating, and continuing to move forward after the gate reopens after the gate closes, rather than two independent passages. As another example, if ear tag B002 appears 2 seconds after A001 completes its passage, and A001 and B002 correspond to their respective independent exit trigger results and weighing results, then this 2-second interval represents a continuous passage interval between two different fattening pigs. If the current ear tag deduplication time is set to 3 seconds, and the longest interruption time after the same ear tag is interrupted by the gate control is 5 seconds, the same pig will be mistakenly judged as passing twice; if the current ear tag deduplication time is set to 6 seconds, and the shortest time interval between different fattening pigs passing through consecutively is 2 seconds, two different pigs will be mistakenly merged into one passing.
[0028] The method described above determines whether the current ear tag deduplication time is applicable to the current slaughter passage status, rather than relying solely on fixed empirical values, historical average intervals, or the number of times a single ear tag repeatedly appears. This is because the method simultaneously utilizes two time boundaries that directly reflect the actual passage status: the discontinuous appearance time of the same ear tag under channel control and the normal continuous passage time of different ear tags. This allows for constraints on the current ear tag deduplication time from two directions: "preventing the same pig from being counted repeatedly" and "preventing different pigs from being incorrectly merged." Therefore, the deduplication time is no longer statically set detached from the actual situation. Instead, it is determined based on the actual passage interruptions caused by buffer gates, limit gates, or diversion gates, as well as the actual continuous passage of adjacent different fattening pigs. This allows for a more accurate distinction between the reappearance of the same fattening pig after a channel control interruption and the continuous passage of different fattening pigs. It avoids double counting of the same pig due to an excessively short deduplication time and incorrect merging of different pigs due to an excessively long deduplication time, thereby improving the accuracy of the correspondence between slaughter counting results and weighing information, channel information, and loading destination.
[0029] In one embodiment, S3: When it is determined that the current ear tag deduplication time is not applicable to the current exit passage status, the step of re-determining the ear tag deduplication time based on the non-continuous occurrence of the same ear tag and the continuous occurrence of adjacent different ear tags is as follows: Extract the interruption times corresponding to the non-continuous occurrences of each ear tag to form a set of non-continuous occurrence times; Extract the time intervals corresponding to the consecutive occurrences of adjacent different ear tags to form a set of consecutive occurrence times; Determine the maximum interruption time in the set of discontinuous occurrence times and the minimum time interval in the set of continuous occurrence times; When the maximum interruption time is less than the minimum time interval, the time value between the maximum interruption time and the minimum time interval is determined as the candidate deduplication time; Calculate the number of identical earmark merging errors and different earmark merging errors corresponding to each candidate deduplication time, and determine the candidate deduplication time with the smallest sum of identical earmark merging errors and different earmark merging errors as the re-determined earmark deduplication time; Among them, the number of errors in merging the same eartag is: the number of times the interruption time between two adjacent occurrences of the same eartag is greater than the candidate deduplication time; the number of errors in merging different eartags is: the number of times the time interval between consecutive occurrences of adjacent different eartags is not greater than the candidate deduplication time. When the maximum interruption time is not less than the minimum time interval, determine that there is no valid time interval in the current exit channel that can be used to reset the ear tag deduplication time, and output the result that the ear tag deduplication time cannot be reset.
[0030] It should be noted that, for example, within a certain time period, statistics show that eartag A001 appears twice discontinuously due to the limit gate closing and then reopening, with interruption times of 4 seconds and 5 seconds respectively; eartag A003 appears once discontinuously with an interruption time of 6 seconds. Therefore, the set of discontinuous appearance times is {4 seconds, 5 seconds, 6 seconds}, with a maximum interruption time of 6 seconds. Simultaneously, statistics on the consecutive appearance of adjacent different eartags show that the interval between consecutive appearances of A001 and B002 is 9 seconds, between B002 and C003 is 8 seconds, and between C003 and D004 is 10 seconds. Therefore, the set of consecutive appearance times is {9 seconds, 8 seconds, 10 seconds}, with a minimum time interval of 8 seconds. Since 6 seconds is less than 8 seconds, there is still a valid interval where the deduplication time can be reset. Therefore, the time values between 6 seconds and 8 seconds are used as candidate deduplication times, for example, 6.5 seconds, 7 seconds, and 7.5 seconds. Next, calculate the error scenarios for each candidate value: When the candidate deduplication time is 6.5 seconds, the interruption time for A001 and A003 is no greater than 6.5 seconds, so the number of errors in merging the same eartag is 0; while there are no consecutive occurrences of different eartags with an interval no greater than 6.5 seconds, so the number of errors in merging different eartags is also 0, and the total number of errors is 0. If the candidate deduplication time is 7.5 seconds, the number of errors in merging the same eartag is still 0, but if the consecutive occurrence interval of a pair of different eartags is 7 seconds, then the pair of different eartags will be mistakenly merged. In this case, the number of errors in merging different eartags is 1, and the total number of errors is 1. Therefore, 6.5 seconds, which has a smaller total number of errors, will be preferentially selected as the re-determined eartag deduplication time. For example, if the statistical results change to a non-continuous occurrence time set of {5 seconds, 7 seconds, 8 seconds} with a maximum interruption time of 8 seconds, and a continuous occurrence time set of {6 seconds, 7 seconds, 9 seconds} with a minimum time interval of 6 seconds, then since 8 seconds is no less than 6 seconds, it means that the longest intermittent occurrence of the same ear tag can reach 8 seconds, while the shortest interval between consecutive passing of different ear tags is only 6 seconds. The time ranges of the two overlap. At this time, no matter whether the deduplication time is set to around 6 seconds, 7 seconds, or 8 seconds, it is impossible to avoid both the errors of "same pigs being separated" and "different pigs being merged". Therefore, the result of the ear tag deduplication time not being reset should be directly output.
[0031] It should be noted that the above method is used to redetermine the ear tag deduplication time, rather than relying on manual experience, fixed preset values, or simply averaging intervals. This method directly uses two types of key time boundaries identified in the current slaughtering site: one is the discontinuous interruption time caused by the same ear tag due to channel control, and the other is the time interval between the normal continuous passage of adjacent different ear tags. By simultaneously counting the number of errors in merging the same ear tag and the number of errors in merging different ear tags, the deduplication time with the minimum total error is found within the selectable time interval. Therefore, the redetermined ear tag deduplication time is not a static parameter detached from the actual situation, but an adapted result generated based on the current channel rhythm, gate control, and pig passage status. This can minimize the duplication of the same fattening pig while minimizing the erroneous merging of different fattening pigs, thereby improving the consistency between ear tag counting results and actual passage behavior, and improving the accuracy of binding weighing information, channel information, and loading destination.
[0032] In one implementation, the output of the ear tag deduplication time, which cannot be reset, includes: Control the buffer gate, limit gate or diversion gate to enter the flow restriction release state, so as to increase the release time interval between adjacent fattening pigs; Under the flow control and release status, re-collect subsequent ear tag reading information, channel exit trigger results, and weighing results; Based on the re-acquired ear tag reading information, channel exit trigger results, and weighing results, the interruption time corresponding to the non-continuous appearance of the same ear tag and the time interval corresponding to the continuous appearance of adjacent different ear tags are re-extracted. When the maximum interruption time after re-extraction is less than the minimum time interval after re-extraction, the ear tag deduplication time is re-determined, and the exit pass record is generated based on the re-determined ear tag deduplication time. When the maximum interruption time after re-extraction is not less than the minimum time interval after re-extraction, the corresponding ear tag appearance record is identified as an abnormal slaughter record, and the fattening pigs corresponding to the abnormal slaughter record are imported into the review channel for single-pig review.
[0033] It should be noted that, for example, during the slaughtering of a batch of fattening pigs, if it is determined that the current ear tag deduplication time cannot be reset because the statistically determined maximum interruption time for the same ear tag is 8 seconds, while the minimum consecutive passage interval for adjacent different ear tags is only 6 seconds, the two overlap. At this point, the pigs are no longer released at the original channel rhythm. Instead, the buffer gates and limit gates are controlled to enter a flow-limited release state. For example, instead of releasing one pig every 2 seconds, the interval is adjusted to one pig every 6 or 8 seconds, thus increasing the artificial interval between consecutive pigs. Under this flow-limited release state, subsequent data is re-collected. For example, after ear tag A101 is read, the exit trigger is completed and weighing is finished 4 seconds later. Ear tag B102 is read 7 seconds after A101 completes its exit trigger and weighing. At this point, the statistically determined maximum interruption time for the same ear tag is 4 seconds, while the minimum consecutive passage interval for adjacent different ear tags is only 6 seconds. The minimum consecutive passage interval is 7 seconds, indicating that a distinguishable interval has been re-established under the new channel status. Therefore, the ear tag deduplication time is re-determined, for example, to 5 seconds, and the exit passage records of A101 and B102 are generated based on this re-determined ear tag deduplication time. For another example, after the flow restriction release, ear tag C103 still shows a 5-second discontinuous interruption, while the minimum consecutive passage interval between adjacent different ear tags D104 and E105 is still only 4 seconds. This indicates that even under the flow restriction release status, the intermittent appearance of the same pig and the continuous passage of different pigs cannot be effectively distinguished. At this time, the automatic judgment is no longer continued. Instead, the ear tag appearance records corresponding to C103, D104, and E105 are identified as abnormal exit records, and the corresponding fattening pigs are imported into the review channel. The ear tag reading, exit confirmation, and weighing confirmation are re-completed in the manner of passing through one pig at a time.
[0034] In one embodiment, S4: The steps of merging or distinguishing the ear tag reading information based on the re-determined ear tag deduplication time, generating a slaughter passage record, and combining it with channel exit information, weighing information, and loading destination information to obtain the fattening pig slaughter count traceability result are as follows: Arrange the records of each occurrence of the same ear tag in chronological order; The time interval between two consecutive occurrences is compared with the redetermined deduplication time. If the time interval is greater than the redetermined deduplication time, the two consecutive occurrences are separated into two independent candidate passes. If the time interval is not greater than the redetermined deduplication time, the two consecutive occurrences are merged into one candidate pass. For each candidate pass record, determine its corresponding start and end read times; For each candidate pass record, the channel exit trigger result is matched within the first preset time window after the end of reading time, and the channel exit trigger result that appears first in time and is later than the end of reading time is determined as the exit result corresponding to the candidate pass record; if no channel exit trigger result is matched within the first preset time window, the candidate pass record is determined as an abnormal exit record. After matching the exit result, the weighing result is matched again within the second preset time window after the trigger time corresponding to the exit result, and the weighing result that appears first in time and is later than the trigger time corresponding to the exit result is determined as the weighing result corresponding to the candidate pass record; when no weighing result is matched within the second preset time window, the candidate pass record is determined as an abnormal exit record. After the weighing result is matched, the loading destination result is matched within the third preset time window after the time corresponding to the weighing result. The loading destination result that appears first in time and is later than the time corresponding to the weighing result is determined as the loading destination result corresponding to the candidate pass record. If no loading destination result is matched within the third preset time window, the candidate pass record is determined as an abnormal exit record. Candidate passing records that simultaneously match export results, weighing results, and loading destination results are identified as valid exit passing records, and the ear tag number, start reading time, end reading time, export results, weighing results, and loading destination results are bound together. The system accumulates the count of each valid pig slaughter through records, and outputs the corresponding exit result, weighing result, and loading destination result according to the ear tag number, generating the traceability result of fattening pig slaughter count.
[0035] It should be noted that, for example, if ear tag A001 is read for the first time from 10:00:01 to 10:00:03 and for the second time from 10:00:06 to 10:00:08, and the deduplication time for the newly determined ear tag is 2 seconds, then the time interval between the two occurrences is 3 seconds, which is greater than 2 seconds. Therefore, the two occurrences of A001 are distinguished as two independent candidate passes. If ear tag B002 is read for the first time from 10:00:12 to 10:00:14 and for the second time from 10:00:15 to 10:00:17, and the time interval between the two occurrences is only 1 second, which is no greater than 2 seconds, then the two occurrences of B002 are merged into one candidate pass record. For example, for the first candidate pass record A001, its end reading time is 10:00:03. The system first searches for the channel exit trigger result within the first preset time window after 10:00:03. If an exit trigger result is found at 10:00:05, the exit trigger result is matched to the candidate pass record. Subsequently, it searches for the weighing result within the second preset time window after 10:00:05. If a weighing result is found at 10:00:07, the weighing result is matched to the candidate pass record. Next, it searches for the loading destination result within the third preset time window after 10:00:07. If a loading destination of vehicle number 1 is found at 10:00:09, the loading destination is matched to the candidate pass record. Selecting a passing record, the candidate passing record A001 is thus identified as a valid exit passing record, and is bound with ear tag number A001, start reading time 10:00:01, end reading time 10:00:03, exit trigger time 10:00:05, weighing result, and loading destination of vehicle No. 1. For example, if the candidate passing record corresponding to ear tag C003 matches the exit trigger result after the end of reading, but does not match the weighing result within the second preset time window, then the candidate passing record is directly identified as an abnormal exit passing record. Similarly, if ear tag D004 matches the exit result and weighing result, but does not match the loading destination result within the third preset time window, it is also identified as an abnormal exit passing record. Finally, if, for example, all three ear tags A001, B002, and E005 have completed the complete matching of export, weighing, and loading destination, then the cumulative count of these three valid shipments will be recorded as 3, and the traceability results corresponding to vehicle 1 (A001), vehicle 2 (B002), and vehicle 1 (E005) will be output respectively.
[0036] Based on the same inventive concept, embodiments of the present invention also provide a piglet counting and traceability system based on ear tag recognition and channel optimization. This includes: Information module: Acquires ear tag reading information and channel operation information generated during the fattening pig slaughter process, and determines the ear tag appearance status of each fattening pig in the slaughter channel based on the ear tag reading information; Passage Status Module: Based on the ear tag appearance status and channel operation information, determine whether the same ear tag has a discontinuous appearance caused by the channel control process, and determine whether the current ear tag deduplication time is applicable to the current exit passage status; Deduplication Time Module: When it is determined that the current deduplication time for ear tags is not applicable to the current exit passage status, the deduplication time for ear tags is re-determined based on the non-continuous occurrence of the same ear tag and the continuous occurrence of adjacent different ear tags; The traceability result module merges or distinguishes the ear tag reading information based on the redefined ear tag deduplication time, generates a slaughter passage record, and combines the channel exit information, weighing information, and loading destination information to obtain the traceability result of fattening pig slaughter count.
[0037] The above description is merely a preferred embodiment of the present invention and is not intended to limit the present invention in any way. Although the present invention has been disclosed above with reference to preferred embodiments, it is not intended to limit the present invention. Any person skilled in the art can make some modifications or alterations to the above-disclosed technical content to create equivalent embodiments without departing from the scope of the present invention. Any simple modifications, equivalent changes and alterations made to the above embodiments based on the technical essence of the present invention without departing from the scope of the present invention should still fall within the scope of the claims of the present invention.
Claims
1. A method for counting and tracing pigs at market age based on ear tag recognition and channel optimization, characterized in that, Includes the following steps: Acquire ear tag reading information and channel operation information generated during the fattening pig slaughter process, and determine the ear tag appearance status of each fattening pig in the slaughter channel based on the ear tag reading information; Based on the ear tag appearance status and channel operation information, determine whether the same ear tag has a discontinuous appearance caused by the channel control process, and determine whether the current ear tag deduplication time is applicable to the current exit passage status; When it is determined that the current deduplication time for ear tags is not applicable to the current exit passage status, the deduplication time for ear tags is re-determined based on the non-continuous occurrence of the same ear tag and the continuous occurrence of adjacent different ear tags. Based on the redefined ear tag deduplication time, the ear tag reading information is merged or distinguished to generate a slaughter passage record. Combined with channel exit information, weighing information, and loading destination information, the traceability result of fattening pig slaughter count is obtained.
2. The method for counting and tracing pig slaughter based on ear tag recognition and channel optimization according to claim 1, characterized in that, The steps to determine whether the same ear tag has a discontinuous occurrence caused by the channel control process, and to determine whether the current ear tag deduplication time is applicable to the current exit passage status, are as follows: Arrange the records of multiple appearances of the same ear tag during the breeding process in chronological order, and extract the interruption time between two adjacent appearance records; The interruption time is compared with the closing time and reopening time of the buffer door, limit door, or diversion door; When the interruption time falls at least partially between the closing time and reopening time of the buffer gate, limit gate, or diversion gate, and the ear tag numbers corresponding to two adjacent occurrences are the same, and there is no channel exit trigger result and weighing result corresponding to the ear tag between the two occurrences, the two adjacent occurrences are determined to be non-continuous occurrences formed by the same fattening pig under the channel control process. Extract the interrupt time corresponding to each non-continuous occurrence and determine the maximum interrupt time in the set of non-continuous occurrence times; Extract the time interval between the occurrence records of adjacent different ear tags, and when there are independent channel exit trigger results and independent weighing results between adjacent different ear tags, determine the time interval as the continuous passage interval of different fattening pigs, and then determine the minimum time interval in the set of continuous passage intervals. The current ear tag deduplication time is compared with the maximum interruption time and the minimum time interval. Based on the comparison results, it is determined whether the current ear tag deduplication time is applicable to the current exit passage status.
3. The method for counting and tracing pig slaughter based on ear tag recognition and channel optimization according to claim 2, characterized in that, The steps to determine whether the current ear tag deduplication time is applicable to the current livestock passage status based on the comparison results are as follows: When the current ear tag deduplication time is less than the maximum interruption time, it is determined that the current ear tag deduplication time is not applicable to the current exit passage status. When the current ear tag deduplication time is greater than the minimum time interval, it is determined that the current ear tag deduplication time is not applicable to the current exit passage status; When the current ear tag deduplication time is not less than the maximum interruption time and not greater than the minimum time interval, it is determined that the current ear tag deduplication time is applicable to the current exit passage status.
4. The method for counting and tracing pig slaughter based on ear tag recognition and channel optimization according to claim 1, characterized in that, Based on the non-contiguous occurrence of the same ear tag and the consecutive occurrence of adjacent different ear tags, the steps to redetermine the ear tag deduplication time are as follows: Extract the interruption times corresponding to the non-continuous occurrences of each ear tag to form a set of non-continuous occurrence times; Extract the time intervals corresponding to the consecutive occurrences of adjacent different ear tags to form a set of consecutive occurrence times; Determine the maximum interruption time in the set of discontinuous occurrence times and the minimum time interval in the set of continuous occurrence times; When the maximum interruption time is less than the minimum time interval, the time value between the maximum interruption time and the minimum time interval is determined as the candidate deduplication time; Calculate the number of identical earmark merging errors and different earmark merging errors corresponding to each candidate deduplication time, and determine the candidate deduplication time with the smallest sum of identical earmark merging errors and different earmark merging errors as the re-determined earmark deduplication time.
5. The method for counting and tracing pig slaughter based on ear tag recognition and channel optimization according to claim 4, characterized in that, The number of errors in merging the same ear tag is defined as the number of times the interruption time between two adjacent occurrences of the same ear tag is greater than the candidate deduplication time. The number of errors in merging different ear tags is defined as the number of times when the time interval between consecutive occurrences of adjacent different ear tags is no greater than the candidate deduplication time. When the maximum interruption time is not less than the minimum time interval, determine that there is no valid time interval in the current exit channel that can be used to reset the ear tag deduplication time, and output the result that the ear tag deduplication time cannot be reset.
6. The method for counting and tracing pig slaughter based on ear tag recognition and channel optimization according to claim 5, characterized in that, The output ear tag deduplication time, which cannot be reset, includes: Control the buffer gate, limit gate or diversion gate to enter the flow restriction release state, so as to increase the release time interval between adjacent fattening pigs; Under the flow control and release status, re-collect subsequent ear tag reading information, channel exit trigger results, and weighing results; Based on the re-acquired ear tag reading information, channel exit trigger results, and weighing results, the interruption time corresponding to the non-continuous appearance of the same ear tag and the time interval corresponding to the continuous appearance of adjacent different ear tags are re-extracted. When the maximum interruption time after re-extraction is less than the minimum time interval after re-extraction, the ear tag deduplication time is re-determined, and the exit pass record is generated based on the re-determined ear tag deduplication time. When the maximum interruption time after re-extraction is not less than the minimum time interval after re-extraction, the corresponding ear tag appearance record is identified as an abnormal slaughter record, and the fattening pigs corresponding to the abnormal slaughter record are imported into the review channel for single-pig review.
7. The method for counting and tracing pig slaughter based on ear tag recognition and channel optimization according to claim 1, characterized in that, The steps to obtain the traceability results of fattening pig slaughter count are as follows: Arrange the records of each occurrence of the same ear tag in chronological order, and compare the time interval between two adjacent occurrence records with the newly determined ear tag deduplication time; When the time interval is greater than the redetermined deduplication time for ear tags, two adjacent occurrences are distinguished as two independent candidate passes; when the time interval is not greater than the redetermined deduplication time for ear tags, two adjacent occurrences are merged into one candidate pass. For each candidate, its start and end reading times are determined by recording, and the channel exit trigger result is matched within the first preset time window after the end reading time. After matching the output result, the weighing result is matched again within the second preset time window after the trigger time corresponding to the output result; After the weighing result is matched, the loading destination result is matched again in the third preset time window after the time corresponding to the weighing result. When a candidate pass record is matched with the exit result, weighing result, and loading destination result in sequence, it is determined as a valid exit pass record and the ear tag number, start reading time, end reading time, exit result, weighing result, and loading destination result are bound. If no matching result is found within any preset time window, the candidate record will be identified as an abnormal outgoing record. The system accumulates the count of each valid pig slaughter through records, and outputs the corresponding exit result, weighing result, and loading destination result according to the ear tag number, generating traceability results for fattening pig slaughter count.
8. A piglet slaughter counting and traceability system based on ear tag recognition and channel optimization, used to implement the piglet slaughter counting and traceability method based on ear tag recognition and channel optimization as described in any one of claims 1-7, characterized in that, The system includes: Information module: Acquires ear tag reading information and channel operation information generated during the fattening pig slaughter process, and determines the ear tag appearance status of each fattening pig in the slaughter channel based on the ear tag reading information; Passage Status Module: Based on the ear tag appearance status and channel operation information, determine whether the same ear tag has a discontinuous appearance caused by the channel control process, and determine whether the current ear tag deduplication time is applicable to the current exit passage status; Deduplication Time Module: When it is determined that the current deduplication time for ear tags is not applicable to the current exit passage status, the deduplication time for ear tags is re-determined based on the non-continuous occurrence of the same ear tag and the continuous occurrence of adjacent different ear tags; The traceability result module merges or distinguishes the ear tag reading information based on the redefined ear tag deduplication time, generates a slaughter passage record, and combines the channel exit information, weighing information, and loading destination information to obtain the traceability result of fattening pig slaughter count.