WO2020030052A1 - Animal count identification method, device, medium, and electronic apparatus - Google Patents

Animal count identification method, device, medium, and electronic apparatus Download PDF

Info

Publication number
WO2020030052A1
WO2020030052A1 PCT/CN2019/099817 CN2019099817W WO2020030052A1 WO 2020030052 A1 WO2020030052 A1 WO 2020030052A1 CN 2019099817 W CN2019099817 W CN 2019099817W WO 2020030052 A1 WO2020030052 A1 WO 2020030052A1
Authority
WO
WIPO (PCT)
Prior art keywords
animal
matrix
image
recognition model
animals
Prior art date
Application number
PCT/CN2019/099817
Other languages
French (fr)
Chinese (zh)
Inventor
王怀庆
Original Assignee
京东数字科技控股有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 京东数字科技控股有限公司 filed Critical 京东数字科技控股有限公司
Publication of WO2020030052A1 publication Critical patent/WO2020030052A1/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F18/00Pattern recognition
    • G06F18/20Analysing
    • G06F18/21Design or setup of recognition systems or techniques; Extraction of features in feature space; Blind source separation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F18/00Pattern recognition
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V10/00Arrangements for image or video recognition or understanding
    • G06V10/70Arrangements for image or video recognition or understanding using pattern recognition or machine learning
    • G06V10/74Image or video pattern matching; Proximity measures in feature spaces
    • G06V10/75Organisation of the matching processes, e.g. simultaneous or sequential comparisons of image or video features; Coarse-fine approaches, e.g. multi-scale approaches; using context analysis; Selection of dictionaries
    • G06V10/751Comparing pixel values or logical combinations thereof, or feature values having positional relevance, e.g. template matching

Abstract

Embodiments of the present disclosure provide an animal count identification method, a device, a medium, and an electronic apparatus. The method comprises: acquiring a pre-processed animal image, wherein the pre-processed animal image comprises animals and animal marker points; generating, on the basis of the animal marker points, a digital matrix having the same size as the pre-processed animal image; comparing the digital matrix against a pre-determined training matrix, and generating an animal count identification model on the basis of a comparison result acquired from the comparison; and performing animal count identification on an image on the basis of the animal count identification model. The technical solution of the embodiments in the present disclosure enables accurate and real-time understanding of a total count of farm animals, and achieves accurate calculation of an animal count, thereby ensuring data accuracy, providing directly visible data, and saving labor costs. (FIG. 1)

Description

一种动物数量识别方法、装置、介质及电子设备Animal quantity identification method, device, medium and electronic equipment 技术领域Technical field
本公开涉及基于图像的动物识别技术领域,具体而言,涉及一种动物数量识别方法及一种动物识别装置。The present disclosure relates to the field of image-based animal recognition technology, and in particular, to a method for identifying animal numbers and an animal recognition device.
背景技术Background technique
近年来人工智能技术慢慢引入到生猪养殖过程中,利用大数据技术,分析养殖过程中的数据关联性分析,包括数量识别、猪群行为特征分析、疾病识别和预警、无人过磅等,从而有针对性的发挥大数据猪的价值。In recent years, artificial intelligence technology has been slowly introduced into the pig breeding process, using big data technology to analyze the data correlation analysis in the breeding process, including quantitative identification, herd behavior analysis, disease identification and early warning, and no-weighing. Target the value of big data pigs.
对于一个完整的猪舍监控系统,猪只识别与点数是其中最基础核心的部分,猪只识别是指在输入的图像中识别所有猪只在图像中的位置,猪只点数人工智能技术能够大大的提高养猪效率,节约大量的人工成本。要实现智能化的技术难度大,相关技术研究也比较少。For a complete pig house monitoring system, pig identification and points are the most basic core part. Pig identification refers to identifying the positions of all pigs in the image in the input image. Pig point artificial intelligence technology can greatly Improve pig raising efficiency and save a lot of labor costs. It is difficult to realize intelligent technology, and related technology research is relatively small.
目前养猪场在进行猪个体数量识别的基本方法如下:The basic methods for identifying the number of pigs in a pig farm are as follows:
(1)通过选用空栏猪圈并在四周涂上绿色涂料,然后通过识别非绿色区域即为猪只区域。(1) By selecting empty pens and applying green paint around them, and then identifying non-green areas as pig areas.
(2)通过改进的帧间差分法来检测运动猪只,主要是根据运动信息来检测目标。(2) Detecting moving pigs through an improved inter-frame difference method, mainly detecting targets based on motion information.
(3)通过色彩空间聚类模型猪只识别算法,对猪只颜色特征进行猪只识别。(3) Pig color recognition based on color space clustering model pig identification algorithm.
上述现有技术方案存在以下缺点:The above prior art solutions have the following disadvantages:
(1)通过给空栏猪圈涂颜料,该方法在实验测试阶段可行,实际场景猪只数量庞大,操作起来比较困难,场地成本较大。(1) By coating the empty pens with pigsty, this method is feasible in the experimental test stage. In the actual scenario, the number of pigs is huge, it is difficult to operate, and the site cost is large.
(2)通过帧间差分法,考虑到猪的习性,有可能长时间不动,应用运动信息监测就会失灵。(2) The interframe difference method, taking into account the habit of the pig, may not move for a long time, and the application of motion information monitoring will fail.
(3)通过色彩空间聚类模型猪只识别算法,由于猪只纹理复杂,猪的颜色也比较单一,黑色的猪和猪圈猪栏色彩类似等情况会造成识别不准确,识别率低的现象。(3) Pig color recognition algorithm based on color space clustering model. Due to the complex texture of the pigs and the relatively simple color of the pigs, the similarity between black pigs and pig pens will cause inaccurate recognition and low recognition rate. .
需要说明的是,在上述背景技术部分公开的信息仅用于加强对本公开的背景的理解,因此可以包括不构成对本领域普通技术人员已知的现有技术的信息。It should be noted that the information disclosed in the background section above is only used to enhance the understanding of the background of the present disclosure, and therefore may include information that does not constitute the prior art known to those of ordinary skill in the art.
发明内容Summary of the invention
本公开实施例的目的在于提供一种动物数量识别方法及一种动物识别装置,进而至少在一定程度上克服由于相关技术的限制和缺陷而导致的动物数量确定的操作难度大、动物长时间不动的情况无法准确识别动物数量和色彩识别动物数量方法容易受到环境影响而识别不准确的一个或多个问题。The purpose of the embodiments of the present disclosure is to provide a method for identifying animal numbers and an animal identification device, thereby at least to a certain extent overcoming the limitations and disadvantages of related technologies to determine the number of animals, which is difficult to operate and the animals are not It is difficult to accurately identify the number of animals and the color of the animals. The method of identifying the number of animals is easily affected by the environment and one or more problems of inaccurate identification.
本公开实施例的其他特性和优点将通过下面的详细描述变得显然,或部分地通过本公开的实践而习得。Other features and advantages of the embodiments of the present disclosure will become apparent from the following detailed description, or may be learned in part through the practice of the present disclosure.
根据本公开实施例的第一方面,提供一种动物数量识别方法,包括:According to a first aspect of the embodiments of the present disclosure, a method for identifying an animal quantity includes:
获取预处理动物图像,其中,所述预处理动物图像包括动物和所述动物的标记点;Obtaining a pre-processed animal image, wherein the pre-processed animal image includes an animal and a marker point of the animal;
基于所述动物的标记点,生成与所述预处理动物图像尺寸相同的数字矩阵;Generating a digital matrix having the same size as the pre-processed animal image based on the marked points of the animal;
将所述数字矩阵与预设的训练矩阵进行对比,基于所述对比获得的对比结果,生成动物数量识别模型;Comparing the number matrix with a preset training matrix, and generating an animal number recognition model based on the comparison result obtained by the comparison;
基于所述动物数量识别模型实现图像中动物数量的识别。The identification of the number of animals in the image is realized based on the animal number recognition model.
在本公开的一个实施例中,上述基于所述动物的标记点,生成与所述预处理动物图像尺寸相同的数字矩阵,包括:In an embodiment of the present disclosure, the above-mentioned generating a digital matrix having the same size as the pre-processed animal image based on the marked points of the animal includes:
根据所述动物的标记点确定出所述标记点在所述预处理动物图像的位置坐标;Determining a position coordinate of the marked point in the pre-processed animal image according to the marked point of the animal;
生成与所述预处理动物图像相同尺寸的数字矩阵,其中,所述数字矩阵由0至1范围内的数字构成;Generating a digital matrix of the same size as the pre-processed animal image, wherein the digital matrix is composed of numbers in the range of 0 to 1;
基于所述位置坐标在所述数字矩阵中确定出对应的位置,并以数字1表示所述位置坐标对应的标记点,所述数字矩阵中剩余位置以0进行表示,并使用预设的高斯核函数进行高斯模糊处理,获得与所述预处理动物图像对应的数字矩阵。A corresponding position is determined in the digital matrix based on the position coordinates, and a marked point corresponding to the position coordinate is represented by the number 1, the remaining positions in the digital matrix are represented by 0, and a preset Gaussian kernel is used The function performs Gaussian blur processing to obtain a digital matrix corresponding to the pre-processed animal image.
在本公开的一个实施例中,上述将所述数字矩阵与预设的训练矩阵进行对比,基于所述对比获得的对比结果,生成动物数量识别模型,包括:In an embodiment of the present disclosure, the above-mentioned comparing the digital matrix with a preset training matrix, and generating an animal number recognition model based on the comparison result obtained by the comparison, include:
根据预设的卷积规则,对所述数字矩阵进行运算,获得卷积矩阵;Operate the digital matrix according to a preset convolution rule to obtain a convolution matrix;
将所述卷积矩阵与所述预设的训练矩阵进行比对,获得比对结果;Comparing the convolution matrix with the preset training matrix to obtain a comparison result;
根据所述比对结果,对预设的识别模型进行修正;Correct the preset recognition model according to the comparison result;
对所修正后的识别模型进行识别准确率验证,当所述识别模型的识别准确率大于等于预设的阈值时,生成动物数量识别模型。The recognition accuracy rate of the modified recognition model is verified. When the recognition accuracy rate of the recognition model is greater than or equal to a preset threshold, an animal number recognition model is generated.
在本公开的一个实施例中,上述基于所述动物数量识别模型实现动物数量的识别,包括:In an embodiment of the present disclosure, the above-mentioned identifying the number of animals based on the animal number recognition model includes:
将所获取的待识别动物数量图像输入所述动物数量识别模型,获取所述待识别动物数量图像对应的数字矩阵;Input the acquired image of the number of animals to be identified into the animal number recognition model, and obtain a digital matrix corresponding to the image of the number of animals to be identified;
对所述数字矩阵进行求和,获得所述待识别动物数量图像中动物的数量。Sum the digital matrix to obtain the number of animals in the image of the number of animals to be identified.
根据本公开实施例的第二方面,提供一种动物识别装置,包括:获取模块、第一生成模块、第二生成模块、识别模块;其中,According to a second aspect of the embodiments of the present disclosure, an animal identification device is provided, including: an acquisition module, a first generation module, a second generation module, and an identification module; wherein,
获取模块,用于获取预处理动物图像,其中,所述预处理动物图像包括动物和所述动物的标记点;An acquisition module for acquiring a pre-processed animal image, wherein the pre-processed animal image includes an animal and a marker point of the animal;
第一生成模块,用于基于所述动物的标记点,生成与所述预处理动物图像尺寸相同的数字矩阵;A first generating module, configured to generate a digital matrix having the same size as the pre-processed animal image based on the marked points of the animal;
第二生成模块,用于将所述数字矩阵与预设的训练矩阵进行对比,基于所述对比获得的对比结果,生成动物数量识别模型;A second generating module, configured to compare the digital matrix with a preset training matrix, and generate an animal number recognition model based on the comparison result obtained by the comparison;
识别模块,用于基于所述动物数量识别模型实现图像中动物数量的识别。A recognition module is configured to recognize the number of animals in an image based on the animal number recognition model.
在本公开的一个实施例中,上述第一生成模块具体用于:In an embodiment of the present disclosure, the first generating module is specifically configured to:
根据所述动物的标记点确定出所述标记点在所述预处理动物图像的位置坐标;Determining a position coordinate of the marked point in the pre-processed animal image according to the marked point of the animal;
生成与所述预处理动物图像相同尺寸的数字矩阵,其中,所述数字矩阵由0和1范围内的数字构成;Generating a digital matrix of the same size as the pre-processed animal image, wherein the digital matrix is composed of numbers in the range of 0 and 1;
基于所述位置坐标在所述数字矩阵中确定出对应的位置,并以数字1表示所述位置坐标对应的标记点,所述数字矩阵中剩余位置以0进行表示,并使用预设的高斯核函数进行高斯模糊处理,获得与所述预处理动物图像对应的数字矩阵。A corresponding position is determined in the digital matrix based on the position coordinates, and a marked point corresponding to the position coordinate is represented by the number 1, the remaining positions in the digital matrix are represented by 0, and a preset Gaussian kernel is used The function performs Gaussian blur processing to obtain a digital matrix corresponding to the pre-processed animal image.
在本公开的一个实施例中,上述第二识别模块具体用于:In an embodiment of the present disclosure, the second identification module is specifically configured to:
根据预设的卷积规则,对所述数字矩阵进行运算,获得卷积矩阵;Operate the digital matrix according to a preset convolution rule to obtain a convolution matrix;
将所述卷积矩阵与所述预设的训练矩阵进行比对,获得比对结果;Comparing the convolution matrix with the preset training matrix to obtain a comparison result;
根据所述比对结果,对预设的识别模型进行修正;Correct the preset recognition model according to the comparison result;
对所修正后的识别模型进行识别准确率验证,当所述识别模型的识别准确率大于等于预设的阈值时,生成动物数量识别模型。The recognition accuracy rate of the modified recognition model is verified. When the recognition accuracy rate of the recognition model is greater than or equal to a preset threshold, an animal number recognition model is generated.
在本公开的一个实施例中,上述第二识别模块还具体用于:In an embodiment of the present disclosure, the second identification module is further configured to:
将所获取的待识别动物数量图像输入所述动物数量识别模型,获取所述待识别动物数量图像对应的数字矩阵;Input the acquired image of the number of animals to be identified into the animal number recognition model, and obtain a digital matrix corresponding to the image of the number of animals to be identified;
对所述数字矩阵进行求和,获得所述待识别动物数量图像中动物的数量。Sum the digital matrix to obtain the number of animals in the image of the number of animals to be identified.
根据本公开实施例的第三方面,提供了一种计算机可读介质,其上存储有计算机程序,所述程序被处理器执行时实现如上述实施例中第一方面所述的动物数量识别方法。According to a third aspect of the embodiments of the present disclosure, there is provided a computer-readable medium having stored thereon a computer program that, when executed by a processor, implements the method for identifying an animal quantity as described in the first aspect of the above embodiment .
根据本公开实施例的第四方面,提供了一种电子设备,包括:一个或多个处理器;存储装置,用于存储一个或多个程序,当所述一个或多个程序被所述一个或多个处理器执行时,使得所述一个或多个处理器实现如上述实施例中第一方面所述的动物数量识别方法。According to a fourth aspect of the embodiments of the present disclosure, there is provided an electronic device including: one or more processors; a storage device for storing one or more programs, and when the one or more programs are used by the one When executed by one or more processors, the one or more processors are caused to implement the animal quantity identification method according to the first aspect in the foregoing embodiment.
本公开实施例提供的技术方案可以包括以下有益效果:The technical solutions provided by the embodiments of the present disclosure may include the following beneficial effects:
本公开的一些实施例所提供的技术方案中,通过获取预处理动物图像,其中,所述预处理动物图像包括动物和所述动物的标记点;基于所述动物的标记点,生成与所述预处理动物图像尺寸相同的数字矩阵;将所述数字矩阵与预设的训练矩阵进行对比,基于所述对比获得的对比结果,生成动物数量识别模型;基于所述动物数量识别模型实现图像中动物数量的识别。本公开实施例的技术方案能够准确实时的掌握饲养场动物的总体数量,对动物数量进行了精准计算,保证了数据的准确性,并且直观可视,节约了大量人力成本。In the technical solution provided by some embodiments of the present disclosure, a pre-processed animal image is obtained by obtaining the pre-processed animal image, and the pre-processed animal image includes an animal and a marker point of the animal; Pre-processing a digital matrix of the same size as the animal image; comparing the digital matrix with a preset training matrix, and generating an animal number recognition model based on the comparison result obtained by the comparison; implementing the animal in the image based on the animal number recognition model Identification of quantity. The technical solution of the embodiment of the present disclosure can accurately grasp the total number of animals on the farm in real time, accurately calculate the number of animals, ensure the accuracy of the data, and be intuitive and visible, and save a lot of labor costs.
应当理解的是,以上的一般描述和后文的细节描述仅是示例性和解释性的,并不能限制本公开。It should be understood that the above general description and the following detailed description are merely exemplary and explanatory, and should not limit the present disclosure.
附图说明BRIEF DESCRIPTION OF THE DRAWINGS
此处的附图被并入说明书中并构成本说明书的一部分,示出了符合本公开的实施例,并与说明书一起用于解释本公开的原理。显而易见地,下面描述中的附图仅仅是本公开的一些 实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图。在附图中:The drawings herein are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present disclosure, and together with the description serve to explain the principles of the present disclosure. Obviously, the drawings in the following description are only some embodiments of the present disclosure. For a person of ordinary skill in the art, other drawings can be obtained based on these drawings without creative efforts. In the drawings:
图1示意性示出了根据本公开的一个实施例的动物数量识别方法的流程图;FIG. 1 schematically illustrates a flowchart of an animal number recognition method according to an embodiment of the present disclosure;
图2示意性示出了根据本公开的一个实施例的预处理图像的示意图;FIG. 2 schematically illustrates a pre-processed image according to an embodiment of the present disclosure;
图3示意性示出了根据本公开的一个实施例动物数量识别方法应用于猪只个体数量识别的流程图;FIG. 3 schematically illustrates a flow chart of an animal number recognition method applied to identifying individual pigs according to an embodiment of the present disclosure; FIG.
图4示意性示出了根据本公开的一个实施例的动物识别装置的框图;4 schematically illustrates a block diagram of an animal identification device according to an embodiment of the present disclosure;
图5示出了适于用来实现本公开实施例的电子设备的计算机系统的结构示意图。FIG. 5 is a schematic structural diagram of a computer system suitable for implementing an electronic device according to an embodiment of the present disclosure.
具体实施方式detailed description
现在将参考附图更全面地描述示例实施方式。然而,示例实施方式能够以多种形式实施,且不应被理解为限于在此阐述的范例;相反,提供这些实施方式使得本公开将更加全面和完整,并将示例实施方式的构思全面地传达给本领域的技术人员。Example embodiments will now be described more fully with reference to the accompanying drawings. However, the example embodiments can be implemented in various forms and should not be construed as limited to the examples set forth herein; rather, the embodiments are provided so that this disclosure will be more comprehensive and complete, and the concepts of the example embodiments will be fully conveyed To those skilled in the art.
此外,所描述的特征、结构或特性可以以任何合适的方式结合在一个或更多实施例中。在下面的描述中,提供许多具体细节从而给出对本公开的实施例的充分理解。然而,本领域技术人员将意识到,可以实践本公开的技术方案而没有特定细节中的一个或更多,或者可以采用其它的方法、组元、装置、步骤等。在其它情况下,不详细示出或描述公知方法、装置、实现或者操作以避免模糊本公开的各方面。Furthermore, the described features, structures, or characteristics may be combined in any suitable manner in one or more embodiments. In the following description, many specific details are provided to give a full understanding of the embodiments of the present disclosure. However, those skilled in the art will realize that the technical solutions of the present disclosure may be practiced without one or more of the specific details, or other methods, components, devices, steps, etc. may be adopted. In other instances, well-known methods, devices, implementations or operations have not been shown or described in detail to avoid obscuring aspects of the present disclosure.
附图中所示的方框图仅仅是功能实体,不一定必须与物理上独立的实体相对应。即,可以采用软件形式来实现这些功能实体,或在一个或多个硬件模块或集成电路中实现这些功能实体,或在不同网络和/或处理器装置和/或微控制器装置中实现这些功能实体。The block diagrams shown in the drawings are merely functional entities and do not necessarily correspond to physically separate entities. That is, these functional entities may be implemented in the form of software, or implemented in one or more hardware modules or integrated circuits, or implemented in different networks and / or processor devices and / or microcontroller devices. entity.
附图中所示的流程图仅是示例性说明,不是必须包括所有的内容和操作/步骤,也不是必须按所描述的顺序执行。例如,有的操作/步骤还可以分解,而有的操作/步骤可以合并或部分合并,因此实际执行的顺序有可能根据实际情况改变。The flowcharts shown in the accompanying drawings are only exemplary descriptions, and it is not necessary to include all contents and operations / steps, nor are they necessarily performed in the order described. For example, some operations / steps can also be decomposed, and some operations / steps can be merged or partially merged, so the order of actual execution may be changed according to the actual situation.
图1示意性示出了根据本公开的一个实施例的动物数量识别方法的流程图。FIG. 1 schematically illustrates a flowchart of an animal number recognition method according to an embodiment of the present disclosure.
参照图1所示,根据本公开的一个实施例的动物数量识别方法,包括以下步骤:Referring to FIG. 1, a method for identifying an animal quantity according to an embodiment of the present disclosure includes the following steps:
步骤S110,获取预处理动物图像;Step S110, obtaining a pre-processed animal image;
步骤S120,基于动物的标记点,生成与预处理动物图像尺寸相同的数字矩阵;Step S120: Generate a digital matrix with the same size as the pre-processed animal image based on the marked points of the animal;
步骤S130,将数字矩阵与预设的训练矩阵进行对比,基于对比获得的对比结果,生成动物数量识别模型;In step S130, the digital matrix is compared with a preset training matrix, and an animal number recognition model is generated based on the comparison result obtained by the comparison;
步骤S140,基于动物数量识别模型实现图像中动物数量的识别。Step S140: Recognize the number of animals in the image based on the animal number recognition model.
图1所示实施例的技术方案能够通过人工智能算法针对人工打标处理的图像进行计算,对所获得的矩阵进行求和计算出动物数量,对动物数量进行了精准计算,保证了数据的准确性,并且直观可视,节约了大量人力成本。The technical solution of the embodiment shown in FIG. 1 can calculate artificially marked images processed by artificial intelligence algorithms, sum the obtained matrix to calculate the number of animals, and accurately calculate the number of animals to ensure the accuracy of the data. It is intuitive and visible, which saves a lot of labor costs.
以下对图1中所示的各个步骤的实现细节进行详细阐述:The implementation details of each step shown in FIG. 1 are described in detail below:
在步骤S110中,获取预处理动物图像。In step S110, a pre-processed animal image is acquired.
在本公开的一个实施例中,预处理动物图像至少包括动物和动物的标记点。In one embodiment of the present disclosure, the pre-processed animal image includes at least the animal and the marked points of the animal.
在本公开的一个实施例中,预处理动物图像中动物的标记点可以是人为对动物图片中的动物进行标记的标记点,获得标记出动物的预处理动物图像,向后续的机器识别流程提供,因此,需要预处理动物图像中打标点与动物一一对应,不能出现漏标动物、标重动物的情况。In an embodiment of the present disclosure, the labeled points of the animals in the pre-processed animal image may be artificially labeled points of the animals in the animal picture, and a pre-processed animal image labeled with the animal is obtained and provided to the subsequent machine recognition process. Therefore, it is necessary to pre-process the marked points in the animal image in a one-to-one correspondence with the animals, and the situation of missing animals or heavy animals cannot occur.
图2示意性示出了根据本公开的一个实施例的预处理图像的示意图。FIG. 2 schematically illustrates a pre-processed image according to an embodiment of the present disclosure.
参照图2所示,预处理动物图像中每个动物的身上均标出了对应的标注点,没有出现漏标和标重的动物,即该预处理动物图像为搞准确率图像,能够为后续提高机器识别算法的准确率提供了良好的基础。As shown in FIG. 2, the corresponding labeled points are marked on each animal in the pre-processed animal image, and there are no missing marks and weight-weighted animals. That is, the pre-processed animal image is an accuracy image, which can be used for subsequent Improving the accuracy of machine recognition algorithms provides a good basis.
在步骤S120中,基于动物的标记点,生成与预处理动物图像尺寸相同的数字矩阵。In step S120, a digital matrix having the same size as the pre-processed animal image is generated based on the marked points of the animal.
在本公开的一个实施例中,根据处理动物图像中动物的标记点确定出标记点在预处理动物图像的位置坐标;生成与预处理动物图像相同尺寸的数字矩阵,其中,数字矩阵由0至1范围内的数字构构成;基于位置坐标在数字矩阵中确定出对应的位置,并以数字1表示位置坐标对应的标记点,数字矩阵中剩余位置以0进行表示,并使用预设的高斯核函数进行高斯模糊处理,获得与预处理动物图像对应的数字矩阵。In an embodiment of the present disclosure, the position coordinates of the marker point in the pre-processed animal image are determined according to the marker points of the processed animal image, and a digital matrix of the same size as the pre-processed animal image is generated, where the number matrix ranges from 0 to The number structure within the range of 1; the corresponding position is determined in the number matrix based on the position coordinates, and the marked point corresponding to the position coordinates is represented by the number 1, the remaining positions in the number matrix are represented by 0, and a preset Gaussian kernel is used The function performs Gaussian blur processing to obtain a digital matrix corresponding to the pre-processed animal image.
在本公开的一个实施例中,对预处理动物图像中的标记点进行提取,提取到标记点的坐标位置,为了后续机器识别模型的训练,将预处理动物图像转化为矩阵,形成一个与预处理动物图像尺寸相同的由0至1范围内的数字构成的数字矩阵,其中,标记点的坐标位置在数字矩阵中设为1,其余元素均设为0。In an embodiment of the present disclosure, the marker points in the pre-processed animal image are extracted and extracted to the coordinate positions of the marker points. For subsequent training of the machine recognition model, the pre-processed animal images are converted into a matrix to form a A digital matrix composed of numbers in the range of 0 to 1 with the same size of the animal image is processed. The coordinate position of the marker point is set to 1 in the digital matrix, and the remaining elements are set to 0.
在步骤S130中,将数字矩阵与预设的训练矩阵进行对比,基于对比获得的对比结果,生成动物数量识别模型。In step S130, the digital matrix is compared with a preset training matrix, and an animal number recognition model is generated based on the comparison result obtained by the comparison.
在本公开的一个实施例中,数字矩阵与预设的训练矩阵进行对比之前,需要对数字矩阵进行卷积处理,根据预设的卷积规则,对数字矩阵进行运算,获得卷积矩阵;将卷积矩阵与预设的训练矩阵进行比对,获得比对结果;根据比对结果,对预设的识别模型进行修正;对所修正后的识别模型进行识别准确率验证,当识别模型的识别准确率大于等于预设的阈值时,生成动物数量识别模型。In an embodiment of the present disclosure, before the digital matrix is compared with a preset training matrix, the digital matrix needs to be convolved, and the digital matrix is operated according to a preset convolution rule to obtain a convolution matrix; The convolution matrix is compared with a preset training matrix to obtain a comparison result; the preset recognition model is modified according to the comparison result; the recognition accuracy of the modified recognition model is verified, and when the recognition model is recognized When the accuracy is greater than or equal to a preset threshold, an animal number recognition model is generated.
在本公开的一个实施例中,卷积规则可以是通过卷积核函数将数字矩阵与高斯核函数进行卷积运算,生成一个新的卷积矩阵,以增强预处理图像对应数字矩阵中信号的特征,并降低噪音等干扰因素。In an embodiment of the present disclosure, the convolution rule may be a convolution operation of a digital matrix and a Gaussian kernel function through a convolution kernel function to generate a new convolution matrix to enhance the signal in the preprocessed image corresponding to the digital matrix. Characteristics, and reduce noise and other interference factors.
在本公开的一个实施例中,将卷积矩阵和预设的训练矩阵进行对比所获得的对比结果可以对预设的识别模型进行训练,在识别模型构建的过程中就需要不断地使用比对结果对识别模型中的参数进行修正,修正后获得动物数量识别模型。In an embodiment of the present disclosure, the comparison result obtained by comparing the convolution matrix with a preset training matrix can train a preset recognition model, and the comparison needs to be continuously used in the process of constructing the recognition model. Results The parameters in the recognition model were modified, and the animal number recognition model was obtained after the modification.
在本公开的一个实施例中,上述识别模型中的各个参数均为初始化状态,在对识别模型进行第一次训练后所获得的对比结果对该识别模型进行一次检查,以确保后续识别模型的迭代结果正确,例如,第一遍计算loss值(对比结果)可以做一次检查,首先,以CIFAR-10为例,如果使用Softmax分类器,预测可以拿到loss值为2.302左右的初始loss(因为10 个类别,初始概率应该都未0.1,Softmax损失是:-log(正确类别的概率):-ln(0.1)=2.302);其次,把正则化系数设为正常的小值,加回正则化项,这时候再算损失/loss;最后,在对大数据集做训练之前,可以先训练一个小的数据集(比如20张图片),然后看看你的神经网络能够做到0损失,因为如果神经网络实现是正确的,在无正则化项的情况下,完全能够过拟合这一小部分的数据;在对识别模型开始进行训练后,可以通过监控一些指标了解训练的状态,例如可以通过loss值在每轮完整迭代后的变化来确定,合适的学习率可以保证每轮完整训练之后,loss值都减小,且能在一段时间后降到一个较小的程度;然后需要跟踪一下训练集和验证集上的准确度状况,以判断分类器所处的状态,随着时间推进,训练集和验证集上的准确度都会上升,如果训练集上的准确度到达一定程度后,两者之间的差值比较大,那就要注意一下,可能是过拟合现象,如果差值不大,那说明识别模型状况良好,最后需要留意的量是权重更新幅度和当前权重幅度的比值,优选的是对每组参数都独立地检查。In an embodiment of the present disclosure, each parameter in the above recognition model is in an initial state, and a comparison result obtained after the first training of the recognition model is performed to check the recognition model once to ensure the subsequent recognition model. The iteration result is correct. For example, the first pass calculation of the loss value (comparison result) can be checked once. First, taking CIFAR-10 as an example, if you use the Softmax classifier, the prediction can get an initial loss of about 2.302 (because For the 10 categories, the initial probability should not be 0.1, and the Softmax loss is: -log (probability of the correct category): -ln (0.1) = 2.302); Second, set the regularization coefficient to a normal small value, and add it back to regularization Term, and then calculate the loss / loss; finally, before training the large data set, you can train a small data set (such as 20 pictures), and then see if your neural network can achieve 0 loss, because If the implementation of the neural network is correct, in the case of no regularization term, it is completely able to overfit this small part of the data; after starting the training of the recognition model, you can monitor some The indicator understands the state of training. For example, it can be determined by the change of the loss value after each full round of iteration. The appropriate learning rate can ensure that after each round of full training, the loss value is reduced, and it can be reduced to a relatively high level after a period of time. Small degree; then you need to track the accuracy status on the training set and the validation set to determine the state of the classifier. As time progresses, the accuracy on the training set and the validation set will increase. After the accuracy reaches a certain level, the difference between the two is relatively large, then it should be noted that it may be an over-fitting phenomenon. If the difference is not large, it indicates that the recognition model is in good condition. The last thing to pay attention to is the weight. The ratio of the update magnitude to the current weight magnitude is preferably checked independently for each set of parameters.
在本公开的一个实施例中,基于前述方案,确定识别模型的训练梯度实现正确后,在后向传播算法中使用其更新权重参数,最常见的权重更新方式是SGD+Momentum,或RMSProp自适应学习率更新算法等;随后,用不同的方式去衰减学习率,介意通过以下常见的方法进行衰减学习率:(1)步伐衰减:每过一轮完整的训练周期(所有的图片都过了一遍)之后,学习率下降一些,(2)指数级别衰减:需要自定义超参数以及迭代轮数,(3)1/t衰减:需要自定义超参数以及迭代轮数;再用交叉验证等去搜索和找到最合适的超参数,其中,对于大的深层次神经网络而言,需要很多的时间去训练,因此在此之前需要做超参数搜索,以确定最佳设定,最直接的方式就是在框架实现的过程中,设计一个会持续变换超参数实施优化,并记录每个超参数下每一轮完整训练迭代下的验证集状态和效果,在实际应用中,神经网络里确定这些超参数,一般很少使用n折交叉验证,一般使用一份固定的交叉验证集就可以了;最后对所获得的识别模型进行模型融合,生成识别准确率大于等于预设阈值的动物数量识别模型,其中,模型融合可以是保留几份中间模型权重和最后的模型权重,对它们求一个平均,再在交叉验证集上测试结果。通常都会比直接训练的模型结果高出一两个百分点。直观的理解是,对于碗状的结构,有很多时候我们的权重都是在最低点附近跳来跳去,而没法真正到达最低点,而两个最低点附近的位置求平均,会有更高的概率落在离最低点更近的位置。In one embodiment of the present disclosure, based on the foregoing scheme, after determining that the training gradient of the recognition model is implemented correctly, it uses its update weight parameter in the backward propagation algorithm. The most common weight update method is SGD + Momentum, or RMSProp adaptive The learning rate update algorithm, etc .; then, the learning rate is attenuated in different ways. Mind the attenuation of the learning rate by the following common methods: (1) Step attenuation: every full round of training cycles (all pictures pass through once) ), The learning rate drops a little, (2) exponential level decay: need to customize the hyperparameters and iteration rounds, (3) 1 / t decay: need to customize the hyperparameters and iteration rounds; then use cross-validation to search And find the most suitable hyperparameters. Among them, for large deep neural networks, it takes a lot of time to train, so before this, you need to do a hyperparameter search to determine the best setting. The most direct way is to During the implementation of the framework, design a continuous transformation of hyperparameters for optimization, and record the validation set under each full training iteration for each hyperparameter. And effect. In practical applications, these hyperparameters are determined in neural networks. Generally, n-fold cross-validation is rarely used, and a fixed cross-validation set is generally used. Finally, the obtained recognition model is model-fused and generated. An identification model for the number of animals whose recognition accuracy is greater than or equal to a preset threshold. The model fusion may be to retain several intermediate model weights and the last model weight, average them, and then test the results on the cross-validation set. It is usually one or two percentage points higher than the results of directly trained models. The intuitive understanding is that for the bowl-shaped structure, there are many times when our weights are jumping around the lowest point, and we can't really reach the lowest point, and averaging the positions near the two lowest points, there will be more A high probability falls closer to the lowest point.
步骤S140,基于动物数量识别模型实现图像中动物数量的识别。Step S140: Recognize the number of animals in the image based on the animal number recognition model.
在本公开的一个实施例中,将所获取的待识别动物数量图像输入动物数量识别模型,获取待识别动物数量图像对应的数字矩阵;对数字矩阵进行求和,获得待识别动物数量图像中动物的数量。In an embodiment of the present disclosure, the acquired image of the number of animals to be identified is input to an animal number recognition model, and a digital matrix corresponding to the image of the number of animals to be identified is obtained; the digital matrix is summed to obtain the animals in the image of the number of animals to be identified. quantity.
本公开实施例提供了一种动物数量识别方法通过获取预处理动物图像,其中,预处理动物图像包括动物和动物的标记点;基于动物的标记点,生成与预处理动物图像尺寸相同的数字矩阵;将数字矩阵与预设的训练矩阵进行对比,基于对比获得的对比结果,生成动物数量识别模型;基于动物数量识别模型实现图像中动物数量的识别。本公开实施例的技 术方案能够准确实时的掌握饲养场动物的总体数量,对动物数量进行了精准计算,保证了数据的准确性,并且直观可视,节约了大量人力成本。An embodiment of the present disclosure provides a method for identifying animal numbers by acquiring a pre-processed animal image, where the pre-processed animal image includes labeled points of the animal and the animal; and based on the labeled points of the animal, a digital matrix having the same size as the pre-processed animal image is generated. ; Compare the digital matrix with a preset training matrix, and generate an animal number recognition model based on the comparison result obtained by the comparison; based on the animal number recognition model, the number of animals in the image is recognized. The technical solution of the embodiment of the present disclosure can accurately grasp the total number of animals on the farm in real time, accurately calculate the number of animals, ensure the accuracy of the data, be intuitive and visible, and save a lot of labor costs.
需要说明的是,上述内容,仅为本公开的较佳实施例而已,并非用于限定本公开的保护范围。It should be noted that the foregoing is merely a preferred embodiment of the present disclosure, and is not intended to limit the protection scope of the present disclosure.
以下介绍本公开所提出动物数量识别方法应用于识别猪只个体数量的实施例。The following describes an embodiment of the method for identifying the number of animals provided by the present disclosure for identifying the number of individual pigs.
图3示意性示出了根据本公开的一个实施例动物数量识别方法应用于猪只个体数量识别的流程图。FIG. 3 schematically illustrates a flowchart of an animal number recognition method applied to identification of individual pig numbers according to an embodiment of the present disclosure.
参照图3所示,根据本公开的一个实施例的动物数量识别方法应用于猪只个体数量识别的流程,包括以下步骤:As shown in FIG. 3, the method for identifying the number of animals according to an embodiment of the present disclosure is applied to the process of identifying individual pigs, and includes the following steps:
步骤S301,识别流程开始;Step S301, the identification process starts;
步骤S302,获取人工打标图片;Step S302, obtaining a manually marked picture;
在本公开的一个实施例中,人工打标图片是指人为对猪只图片进行标记猪只点数,为后续算法提供相应的图片,本步骤的主要功能是为后续机器识别猪只数量训练提供图片,因此,要求打标的图片准确率要高,不会出现漏标、标重的情况。In one embodiment of the present disclosure, the manual marking picture refers to the artificial marking of the pig picture by the pig points, and the corresponding picture is provided for the subsequent algorithm. The main function of this step is to provide the picture for the subsequent machine recognition of pig quantity training. Therefore, the accuracy of the pictures required to be marked should be high, and there will be no missing or heavy marks.
步骤S303,将人工打标图片转化为数字矩阵;Step S303: converting the manually marked picture into a digital matrix;
在本公开的一个实施例中,根据处理动物图像中动物的标记点确定出标记点在预处理动物图像的位置坐标;生成与预处理动物图像相同尺寸的数字矩阵,其中,数字矩阵由0至1范围内的数字构成;基于位置坐标在数字矩阵中确定出对应的位置,并以数字1表示位置坐标对应的标记点,数字矩阵中剩余位置以0进行表示,并使用预设的高斯核函数进行高斯模糊处理,获得与预处理动物图像对应的数字矩阵。In an embodiment of the present disclosure, the position coordinates of the marker point in the pre-processed animal image are determined according to the marker points of the processed animal image, and a digital matrix of the same size as the pre-processed animal image is generated, where the number matrix ranges from 0 to Numbers in the range of 1; the corresponding position is determined in the digital matrix based on the position coordinates, and the corresponding point is marked with the number 1; the remaining positions in the number matrix are represented by 0, and a preset Gaussian kernel function is used Gaussian blurring is performed to obtain a digital matrix corresponding to the pre-processed animal images.
在本公开的一个实施例中,对预处理动物图像中的标记点进行提取,提取到标记点的坐标位置,为了后续机器识别模型的训练,将预处理动物图像转化为矩阵,形成一个与预处理动物图像尺寸相同的由0至1范围内的数字构构成的数字矩阵,其中,标记点的坐标位置在数字矩阵中设为1,其余元素均设为0。In an embodiment of the present disclosure, the marker points in the pre-processed animal image are extracted and extracted to the coordinate positions of the marker points. For subsequent training of the machine recognition model, the pre-processed animal images are converted into a matrix to form a A digital matrix composed of digital structures in the range of 0 to 1 with the same size of the animal image is processed. The coordinate position of the marker point is set to 1 in the digital matrix, and the remaining elements are set to 0.
步骤S304,计算出高斯核函数;Step S304, calculating a Gaussian kernel function;
在本公开的一个实施例中,高斯模糊算法是将正态分布用于图像处理,高斯模糊的原理可以理解为每个像素都取周边像素的平均值,根据设定σ值和模糊半径计算出权重矩阵,作为高斯核函数用于后续步骤的卷积运算。In one embodiment of the present disclosure, the Gaussian blur algorithm uses a normal distribution for image processing. The principle of Gaussian blur can be understood as that each pixel takes the average value of surrounding pixels and calculates it according to the set σ value and the blur radius. The weight matrix is used as a Gaussian kernel function for subsequent convolution operations.
步骤S305,根据高斯核函数对数字矩阵进行卷积运算;Step S305, performing a convolution operation on the digital matrix according to the Gaussian kernel function;
在本公开的一个实施例中,卷积运算指的是使用一个卷积核对图像中的每个像素进行一系列操作,将人工打标的图片转化成矩阵以后与高斯核进行卷积运算,生成一个新的矩阵,其中,卷积运算是图像处理时经常用到的一种操作,它具有增强原信号特征,并且降低噪音的作用。In an embodiment of the present disclosure, a convolution operation refers to using a convolution kernel to perform a series of operations on each pixel in an image, converting a manually marked image into a matrix, and performing a convolution operation with a Gaussian kernel to generate A new matrix, in which the convolution operation is an operation often used in image processing, which has the effect of enhancing the characteristics of the original signal and reducing noise.
步骤S306,获得卷积后的矩阵;Step S306, obtaining a matrix after convolution;
步骤S307,将卷积后的矩阵与步骤S312的反卷积矩阵进行对比;Step S307, comparing the convolved matrix with the deconvolution matrix of step S312;
在本公开的一个实施例中,预测值与真实值的偏差程度的最常见的loss,本算法里反卷积后的图矩阵和卷积运算计算出的标签矩阵进行对比出现的偏差即为loss结果,在算法模型构建的过程中就需要不断地使用loss值对参数进行修正,对算法模型进行迭代,准确率也不断提高,当准确率达标以后,就可以拿猪只图片通过网络计算出新的矩阵,对该矩阵求和就可以得到猪只数量。In an embodiment of the present disclosure, the most common loss of the degree of deviation between the predicted value and the true value. The deviation between the graph matrix after deconvolution and the label matrix calculated by the convolution operation is the loss. As a result, in the process of constructing the algorithm model, it is necessary to continuously use the loss value to modify the parameters, iterate the algorithm model, and the accuracy rate is constantly improved. When the accuracy rate reaches the standard, you can take the pig picture through the network to calculate a new Matrix, sum the matrix to get the number of pigs.
步骤S308,获得训练图矩阵;Step S308, obtaining a training map matrix;
在本公开的一个实施例中,将人工打标的猪只数量图片的原图称为训练图,将训练图改为灰度图,并取其图像矩阵作为训练输入数据。In one embodiment of the present disclosure, the original image of the manually labeled pig quantity picture is called a training image, the training image is changed to a grayscale image, and the image matrix is used as training input data.
步骤S309,通过深度学习卷积神经网络对训练图矩阵进行运算;Step S309: Perform operation on the training graph matrix through a deep learning convolutional neural network;
在本公开的一个实施例中,可以通过VGG深度学习卷积神经网络对训练图矩阵进行运算,VGG是一种深度学习卷积神经网络,展示出网络深度是算法优良性能的关键部分,最好的网络包含了16个卷积层,网络结构非常一致,具体的,VGG是通过几个阶段的卷积特征提取,每层的卷积个数,从首阶段个数开始,每个阶段增长一倍,直到达到最高,然后保持,虽然VGG参数多,层次深,但是需要很少的迭代次数就可以收敛。In one embodiment of the present disclosure, the training graph matrix can be calculated by a VGG deep learning convolutional neural network. VGG is a deep learning convolutional neural network, showing that the network depth is a key part of the excellent performance of the algorithm. The network contains 16 convolutional layers, and the network structure is very consistent. Specifically, VGG is extracted through convolutional features in several stages. The number of convolutions in each layer starts from the number of the first stage and increases by one in each stage. Times until it reaches the highest value, and then keep it. Although there are many VGG parameters and deep levels, it takes a few iterations to converge.
步骤S310,获得训练图矩阵的特征矩阵;Step S310: Obtain a feature matrix of a training graph matrix;
在本公开的一个实施例中,训练图矩阵经过VGG网络得到特征矩阵。In one embodiment of the present disclosure, the training graph matrix is obtained through a VGG network to obtain a feature matrix.
步骤S311,对特征矩阵进行反卷积运算;Step S311, performing a deconvolution operation on the feature matrix;
在本公开的一个实施例中,反卷积运算在神经网络可视化上应用非常成功,本算法对特征矩阵使用反卷积运算,使其获得一些低层次特征,形成与标签矩阵尺寸相当的图矩阵,用于展示预测图像。In one embodiment of the present disclosure, the deconvolution operation is very successful in the application of neural network visualization. This algorithm uses a deconvolution operation on the feature matrix to obtain some low-level features and form a graph matrix that is equivalent in size to the label matrix. For displaying predicted images.
步骤S312,获得反卷积矩阵;Step S312, obtaining a deconvolution matrix;
步骤S313,获得loss结果,生成猪只数量识别模型;Step S313, obtaining a loss result, and generating a pig number recognition model;
在本公开的一个实施例中,预测值与真实值的偏差程度即loss值,本算法里反卷积后的图矩阵和卷积运算计算出的标签矩阵进行对比出现的对比结果即为loss结果,在算法模型构建的过程中就需要不断地使用loss值对其中的参数进行修正,对算法模型进行迭代,算法模型的准确率也不断提高,当准确率达标以后,就可以拿猪只图片通过网络计算出新的矩阵,对该矩阵求和就可以得到猪只数量。In an embodiment of the present disclosure, the degree of deviation between the predicted value and the true value is the loss value. The comparison result between the graph matrix after deconvolution and the label matrix calculated by the convolution operation is the loss result. In the process of algorithm model construction, it is necessary to continuously use the loss value to modify the parameters therein, iterate the algorithm model, and the accuracy rate of the algorithm model is continuously improved. When the accuracy rate reaches the standard, you can take the picture of the pig The network calculates a new matrix and sums the matrix to get the number of pigs.
在本公开的一个实施例中,数字矩阵与预设的训练矩阵进行对比之前,需要对数字矩阵进行卷积处理,根据预设的卷积规则,对数字矩阵进行运算,获得卷积矩阵;将卷积矩阵与预设的训练矩阵进行比对,获得比对结果;根据比对结果,对预设的识别模型进行修正;对所修正后的识别模型进行识别准确率验证,当识别模型的识别准确率大于等于预设的阈值时,生成动物数量识别模型。In an embodiment of the present disclosure, before the digital matrix is compared with a preset training matrix, the digital matrix needs to be convolved, and the digital matrix is operated according to a preset convolution rule to obtain a convolution matrix; The convolution matrix is compared with a preset training matrix to obtain a comparison result; the preset recognition model is modified according to the comparison result; the recognition accuracy of the modified recognition model is verified, and when the recognition model is recognized When the accuracy is greater than or equal to a preset threshold, an animal number recognition model is generated.
在本公开的一个实施例中,卷积规则可以是通过卷积核函数将数字矩阵与高斯核函数进行卷积运算,生成一个新的卷积矩阵,以增强预处理图像对应数字矩阵中信号的特征,并降低噪音等干扰因素。In an embodiment of the present disclosure, the convolution rule may be a convolution operation of a digital matrix and a Gaussian kernel function through a convolution kernel function to generate a new convolution matrix to enhance the signal in the preprocessed image corresponding to the digital matrix. Characteristics, and reduce noise and other interference factors.
在本公开的一个实施例中,将卷积矩阵和预设的训练矩阵进行对比所获得的对比结果 可以对预设的识别模型进行训练,在识别模型构建的过程中就需要不断地使用比对结果对识别模型中的参数进行修正,修正后获得动物数量识别模型。In an embodiment of the present disclosure, the comparison result obtained by comparing the convolution matrix with a preset training matrix can train a preset recognition model, and the comparison needs to be continuously used in the process of constructing the recognition model. Results The parameters in the recognition model were modified, and the animal number recognition model was obtained after the modification.
在本公开的一个实施例中,上述识别模型中的各个参数均为初始化状态,在对识别模型进行第一次训练后所获得的对比结果对该识别模型进行一次检查,以确保后续识别模型的迭代结果正确,例如,第一遍计算loss值(对比结果)可以做一次检查,首先,以CIFAR-10为例,如果使用Softmax分类器,预测可以拿到loss值为2.302左右的初始loss(因为10个类别,初始概率应该都未0.1,Softmax损失是:-log(正确类别的概率):-ln(0.1)=2.302);其次,把正则化系数设为正常的小值,加回正则化项,这时候再算损失/loss;最后,在对大数据集做训练之前,可以先训练一个小的数据集(比如20张图片),然后看看你的神经网络能够做到0损失,因为如果神经网络实现是正确的,在无正则化项的情况下,完全能够过拟合这一小部分的数据;在对识别模型开始进行训练后,可以通过监控一些指标了解训练的状态,例如可以通过loss值在每轮完整迭代后的变化来确定,合适的学习率可以保证每轮完整训练之后,loss值都减小,且能在一段时间后降到一个较小的程度;然后需要跟踪一下训练集和验证集上的准确度状况,以判断分类器所处的状态,随着时间推进,训练集和验证集上的准确度都会上升,如果训练集上的准确度到达一定程度后,两者之间的差值比较大,那就要注意一下,可能是过拟合现象,如果差值不大,那说明识别模型状况良好,最后需要留意的量是权重更新幅度和当前权重幅度的比值,优选的是对每组参数都独立地检查。In an embodiment of the present disclosure, each parameter in the above recognition model is in an initial state, and a comparison result obtained after the first training of the recognition model is performed to check the recognition model once to ensure the subsequent recognition model. The iteration result is correct. For example, the first pass calculation of the loss value (comparison result) can be checked once. First, taking CIFAR-10 as an example, if you use the Softmax classifier, the prediction can get an initial loss of about 2.302 (because For the 10 categories, the initial probability should not be 0.1, and the Softmax loss is: -log (probability of the correct category): -ln (0.1) = 2.302); Second, set the regularization coefficient to a normal small value, and add it back to regularization. Term, and then calculate the loss / loss; finally, before training the large data set, you can train a small data set (such as 20 pictures), and then see if your neural network can achieve 0 loss, because If the implementation of the neural network is correct, in the case of no regularization term, it is completely able to overfit this small part of the data; after starting the training of the recognition model, you can monitor some The standard can understand the training status, for example, it can be determined by the change of the loss value after each full round of iteration. The appropriate learning rate can ensure that after each round of full training, the loss value is reduced, and it can be reduced to a relatively high level after a period of time Small degree; then you need to track the accuracy status on the training set and the validation set to determine the state of the classifier. As time progresses, the accuracy on the training set and the validation set will increase. After the accuracy reaches a certain level, the difference between the two is relatively large, then it should be noted that it may be an over-fitting phenomenon. If the difference is not large, it indicates that the recognition model is in good condition. The last thing to pay attention to is the weight. The ratio of the update magnitude to the current weight magnitude is preferably checked independently for each set of parameters.
在本公开的一个实施例中,基于前述方案,确定识别模型的训练梯度实现正确后,在后向传播算法中使用其更新权重参数,最常见的权重更新方式是SGD+Momentum,或RMSProp自适应学习率更新算法等;随后,用不同的方式去衰减学习率,介意通过以下常见的方法进行衰减学习率:(1)步伐衰减:每过一轮完整的训练周期(所有的图片都过了一遍)之后,学习率下降一些,(2)指数级别衰减:需要自定义超参数以及迭代轮数,(3)1/t衰减:需要自定义超参数以及迭代轮数;再用交叉验证等去搜索和找到最合适的超参数,其中,对于大的深层次神经网络而言,需要很多的时间去训练,因此在此之前需要做超参数搜索,以确定最佳设定,最直接的方式就是在框架实现的过程中,设计一个会持续变换超参数实施优化,并记录每个超参数下每一轮完整训练迭代下的验证集状态和效果,在实际应用中,神经网络里确定这些超参数,一般很少使用n折交叉验证,一般使用一份固定的交叉验证集就可以了;最后对所获得的识别模型进行模型融合,生成识别准确率大于等于预设阈值的动物数量识别模型,其中,模型融合可以是保留几份中间模型权重和最后的模型权重,对它们求一个平均,再在交叉验证集上测试结果。通常都会比直接训练的模型结果高出一两个百分点。直观的理解是,对于碗状的结构,有很多时候我们的权重都是在最低点附近跳来跳去,而没法真正到达最低点,而两个最低点附近的位置求平均,会有更高的概率落在离最低点更近的位置。In one embodiment of the present disclosure, based on the foregoing scheme, after determining that the training gradient of the recognition model is implemented correctly, it uses its update weight parameter in the backward propagation algorithm. The most common weight update method is SGD + Momentum, or RMSProp adaptive The learning rate update algorithm, etc .; then, the learning rate is attenuated in different ways. Mind the attenuation of the learning rate by the following common methods: (1) Step attenuation: every full round of training cycles (all pictures pass through once) ), The learning rate drops a little, (2) exponential level decay: need to customize the hyperparameters and iteration rounds, (3) 1 / t decay: need to customize the hyperparameters and iteration rounds; then use cross-validation to search And find the most suitable hyperparameters. Among them, for large deep neural networks, it takes a lot of time to train, so before this, you need to do a hyperparameter search to determine the best setting. The most direct way is to During the implementation of the framework, design a continuous transformation of hyperparameters for optimization, and record the validation set under each full training iteration for each hyperparameter. And effect. In practical applications, these hyperparameters are determined in neural networks. Generally, n-fold cross-validation is rarely used, and a fixed cross-validation set is generally used. Finally, the obtained recognition model is model-fused and generated. An identification model for the number of animals whose recognition accuracy is greater than or equal to a preset threshold. The model fusion may be to retain several intermediate model weights and the last model weight, average them, and then test the results on the cross-validation set. It is usually one or two percentage points higher than the results of directly trained models. The intuitive understanding is that for the bowl-shaped structure, there are many times when our weights are jumping around the lowest point, and we can't really reach the lowest point, and averaging the positions near the two lowest points, there will be more A high probability falls closer to the lowest point.
步骤S314,判断猪只数量识别模型准确率是否达标,如果是,执行步骤S315;如果不是,返回步骤S308In step S314, it is determined whether the accuracy rate of the pig quantity identification model meets the standard. If so, step S315 is performed; if not, the process returns to step S308.
步骤S315,输出猪只数量识别模型并结束识别流程。In step S315, a pig number recognition model is output and the recognition process is ended.
以下介绍本公开的装置实施例,可以用于执行本公开上述的动物数量识别方法。The following describes the device embodiments of the present disclosure, which can be used to implement the above-mentioned animal number recognition method of the present disclosure.
图4示意性示出了根据本公开的一个实施例的动物识别装置的框图。FIG. 4 schematically illustrates a block diagram of an animal identification device according to an embodiment of the present disclosure.
参照图4所示,根据本公开的一个实施例的动物识别装置400,包括:获取模块401、第一生成模块402、第二生成模块403、识别模块404;其中,Referring to FIG. 4, an animal identification device 400 according to an embodiment of the present disclosure includes: an acquisition module 401, a first generation module 402, a second generation module 403, and an identification module 404;
获取模块401,用于获取预处理动物图像,其中,预处理动物图像包括动物和动物的标记点;The obtaining module 401 is configured to obtain a pre-processed animal image, where the pre-processed animal image includes an animal and a marked point of the animal;
第一生成模块402,用于基于动物的标记点,生成与预处理动物图像尺寸相同的数字矩阵;A first generating module 402, configured to generate a digital matrix having the same size as the pre-processed animal image based on the marked points of the animal;
第二生成模块403,用于将数字矩阵与预设的训练矩阵进行对比,基于对比获得的对比结果,生成动物数量识别模型;A second generating module 403, configured to compare a digital matrix with a preset training matrix, and generate an animal number recognition model based on the comparison result obtained by the comparison;
识别模块404,用于基于动物数量识别模型实现图像中动物数量的识别。The recognition module 404 is configured to recognize the number of animals in the image based on the number of animals recognition model.
在本公开的一个实施例中,上述第一生成模块402具体用于:In an embodiment of the present disclosure, the first generating module 402 is specifically configured to:
根据动物的标记点确定出标记点在预处理动物图像的位置坐标;Determine the position coordinates of the marked point in the pre-processed animal image according to the marked point of the animal;
生成与预处理动物图像相同尺寸的数字矩阵,其中,数字矩阵由0至1范围内的数字构构成;Generate a digital matrix of the same size as the pre-processed animal image, where the digital matrix is composed of digital structures in the range of 0 to 1;
基于位置坐标在数字矩阵中确定出对应的位置,并以数字1表示位置坐标对应的标记点,数字矩阵中剩余位置以0进行表示,并使用预设的高斯核函数进行高斯模糊处理,获得与预处理动物图像对应的数字矩阵。The corresponding position is determined in the digital matrix based on the position coordinates, and the marked point corresponding to the position coordinates is represented by the number 1, the remaining positions in the digital matrix are represented by 0, and the preset Gaussian kernel function is used to perform Gaussian blurring. Digital matrix corresponding to pre-processed animal images.
在本公开的一个实施例中,上述第二识别模块403具体用于:In an embodiment of the present disclosure, the second identification module 403 is specifically configured to:
根据预设的卷积规则,对数字矩阵进行运算,获得卷积矩阵;Operate on a digital matrix according to a preset convolution rule to obtain a convolution matrix;
将卷积矩阵与预设的训练矩阵进行比对,获得比对结果;Compare the convolution matrix with a preset training matrix to obtain the comparison result;
根据比对结果,对预设的识别模型进行修正;Correct the preset recognition model according to the comparison result;
对所修正后的识别模型进行识别准确率验证,当识别模型的识别准确率大于等于预设的阈值时,生成动物数量识别模型。The recognition accuracy rate of the revised recognition model is verified. When the recognition accuracy rate of the recognition model is greater than or equal to a preset threshold, an animal number recognition model is generated.
在本公开的一个实施例中,上述第二识别模块403还具体用于:In an embodiment of the present disclosure, the second identification module 403 is further configured to:
将所获取的待识别动物数量图像输入动物数量识别模型,获取待识别动物数量图像对应的数字矩阵;Input the acquired image of the number of animals to be identified into an animal number recognition model, and obtain a digital matrix corresponding to the image of the number of animals to be identified;
对数字矩阵进行求和,获得待识别动物数量图像中动物的数量。Sum the number matrix to obtain the number of animals in the image of the number of animals to be identified.
由于本公开的示例实施例的动物识别装置的各个功能模块与上述动物数量识别方法的示例实施例的步骤对应,因此对于本公开装置实施例中未披露的细节,请参照本公开上述的动物数量识别方法的实施例。Since each functional module of the animal identification device of the exemplary embodiment of the present disclosure corresponds to the steps of the above-mentioned example embodiment of the animal number identification method, for details not disclosed in the device embodiments of the present disclosure, please refer to the above-mentioned animal number of the present disclosure. Examples of identification methods.
下面参考图5,其示出了适于用来实现本公开实施例的电子设备的计算机系统500的结构示意图。图5示出的电子设备的计算机系统500仅是一个示例,不应对本公开实施例的功能和使用范围带来任何限制。Reference is now made to FIG. 5, which illustrates a schematic structural diagram of a computer system 500 suitable for implementing an electronic device according to an embodiment of the present disclosure. The computer system 500 of the electronic device shown in FIG. 5 is only an example, and should not impose any limitation on the functions and scope of use of the embodiments of the present disclosure.
如图5所示,计算机系统500包括中央处理单元(CPU)501,其可以根据存储在只 读存储器(ROM)502中的程序或者从存储部分508加载到随机访问存储器(RAM)503中的程序而执行各种适当的动作和处理。在RAM 503中,还存储有系统操作所需的各种程序和数据。CPU 501、ROM 502以及RAM 503通过总线504彼此相连。输入/输出(I/O)接口505也连接至总线504。As shown in FIG. 5, the computer system 500 includes a central processing unit (CPU) 501 which can be loaded into a random access memory (RAM) 503 from a program stored in a read-only memory (ROM) 502 or from a storage portion 508 Instead, perform various appropriate actions and processes. In the RAM 503, various programs and data required for system operation are also stored. The CPU 501, the ROM 502, and the RAM 503 are connected to each other through a bus 504. An input / output (I / O) interface 505 is also connected to the bus 504.
以下部件连接至I/O接口505:包括键盘、鼠标等的输入部分1206;包括诸如阴极射线管(CRT)、液晶显示器(LCD)等以及扬声器等的输出部分507;包括硬盘等的存储部分508;以及包括诸如LAN卡、调制解调器等的网络接口卡的通信部分509。通信部分509经由诸如因特网的网络执行通信处理。驱动器510也根据需要连接至I/O接口505。可拆卸介质511,诸如磁盘、光盘、磁光盘、半导体存储器等等,根据需要安装在驱动器510上,以便于从其上读出的计算机程序根据需要被安装入存储部分508。The following components are connected to the I / O interface 505: an input portion 1206 including a keyboard, a mouse, etc .; an output portion 507 including a cathode ray tube (CRT), a liquid crystal display (LCD), etc .; and a speaker; a storage portion 508 including a hard disk, etc. ; And a communication section 509 including a network interface card such as a LAN card, a modem, and the like. The communication section 509 performs communication processing via a network such as the Internet. The driver 510 is also connected to the I / O interface 505 as needed. A removable medium 511, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive 510 as needed, so that a computer program read therefrom is installed into the storage section 508 as needed.
特别地,根据本公开的实施例,上文参考流程图描述的过程可以被实现为计算机软件程序。例如,本公开的实施例包括一种计算机程序产品,其包括承载在计算机可读介质上的计算机程序,该计算机程序包含用于执行流程图所示的方法的程序代码。在这样的实施例中,该计算机程序可以通过通信部分509从网络上被下载和安装,和/或从可拆卸介质511被安装。在该计算机程序被中央处理单元(CPU)501执行时,执行本申请的系统中限定的上述功能。In particular, according to an embodiment of the present disclosure, the process described above with reference to the flowchart may be implemented as a computer software program. For example, embodiments of the present disclosure include a computer program product including a computer program carried on a computer-readable medium, the computer program containing program code for performing a method shown in a flowchart. In such an embodiment, the computer program may be downloaded and installed from a network through the communication section 509, and / or installed from a removable medium 511. When this computer program is executed by a central processing unit (CPU) 501, the above-mentioned functions defined in the system of the present application are executed.
需要说明的是,本公开所示的计算机可读介质可以是计算机可读信号介质或者计算机可读存储介质或者是上述两者的任意组合。计算机可读存储介质例如可以是——但不限于——电、磁、光、电磁、红外线、或半导体的系统、装置或器件,或者任意以上的组合。计算机可读存储介质的更具体的例子可以包括但不限于:具有一个或多个导线的电连接、便携式计算机磁盘、硬盘、随机访问存储器(RAM)、只读存储器(ROM)、可擦式可编程只读存储器(EPROM或闪存)、光纤、便携式紧凑磁盘只读存储器(CD-ROM)、光存储器件、磁存储器件、或者上述的任意合适的组合。在本公开中,计算机可读存储介质可以是任何包含或存储程序的有形介质,该程序可以被指令执行系统、装置或者器件使用或者与其结合使用。而在本公开中,计算机可读的信号介质可以包括在基带中或者作为载波一部分传播的数据信号,其中承载了计算机可读的程序代码。这种传播的数据信号可以采用多种形式,包括但不限于电磁信号、光信号或上述的任意合适的组合。计算机可读的信号介质还可以是计算机可读存储介质以外的任何计算机可读介质,该计算机可读介质可以发送、传播或者传输用于由指令执行系统、装置或者器件使用或者与其结合使用的程序。计算机可读介质上包含的程序代码可以用任何适当的介质传输,包括但不限于:无线、电线、光缆、RF等等,或者上述的任意合适的组合。It should be noted that the computer-readable medium shown in the present disclosure may be a computer-readable signal medium or a computer-readable storage medium or any combination of the foregoing. The computer-readable storage medium may be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples of computer-readable storage media may include, but are not limited to: electrical connections with one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable Programming read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage device, magnetic storage device, or any suitable combination of the foregoing. In this disclosure, a computer-readable storage medium may be any tangible medium that contains or stores a program that can be used by or in combination with an instruction execution system, apparatus, or device. In this disclosure, a computer-readable signal medium may include a data signal that is included in baseband or propagated as part of a carrier wave, and which carries computer-readable program code. Such a propagated data signal may take many forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the foregoing. The computer-readable signal medium may also be any computer-readable medium other than a computer-readable storage medium, and the computer-readable medium may send, propagate, or transmit a program for use by or in connection with an instruction execution system, apparatus, or device . Program code embodied on a computer-readable medium may be transmitted using any appropriate medium, including but not limited to wireless, wireline, optical fiber cable, RF, etc., or any suitable combination of the foregoing.
附图中的流程图和框图,图示了按照本公开各种实施例的系统、方法和计算机程序产品的可能实现的体系架构、功能和操作。在这点上,流程图或框图中的每个方框可以代表一个模块、程序段、或代码的一部分,上述模块、程序段、或代码的一部分包含一个或多个用于实现规定的逻辑功能的可执行指令。也应当注意,在有些作为替换的实现中,方框中所标注的功能也可以以不同于附图中所标注的顺序发生。例如,两个接连地表示的方框 实际上可以基本并行地执行,它们有时也可以按相反的顺序执行,这依所涉及的功能而定。也要注意的是,框图或流程图中的每个方框、以及框图或流程图中的方框的组合,可以用执行规定的功能或操作的专用的基于硬件的系统来实现,或者可以用专用硬件与计算机指令的组合来实现。The flowchart and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present disclosure. In this regard, each block in the flowchart or block diagram may represent a module, a program segment, or a part of code, which contains one or more of the logic functions used to implement the specified logic. Executable instructions. It should also be noted that in some alternative implementations, the functions noted in the blocks may also occur in a different order than those marked in the drawings. For example, two successively represented boxes may actually be executed substantially in parallel, and they may sometimes be executed in the reverse order, depending on the functions involved. It should also be noted that each block in the block diagram or flowchart, and combinations of blocks in the block diagram or flowchart, can be implemented with a dedicated hardware-based system that performs the specified function or operation, or can be implemented with A combination of dedicated hardware and computer instructions.
描述于本公开实施例中所涉及到的单元可以通过软件的方式实现,也可以通过硬件的方式来实现,所描述的单元也可以设置在处理器中。其中,这些单元的名称在某种情况下并不构成对该单元本身的限定。The units described in the embodiments of the present disclosure may be implemented by software or hardware. The described units may also be provided in a processor. The names of these units do not, in some cases, define the unit itself.
作为另一方面,本申请还提供了一种计算机可读介质,该计算机可读介质可以是上述实施例中描述的电子设备中所包含的;也可以是单独存在,而未装配入该电子设备中。上述计算机可读介质承载有一个或者多个程序,当上述一个或者多个程序被一个该电子设备执行时,使得该电子设备实现如上述实施例中的动物数量识别方法。As another aspect, the present application also provides a computer-readable medium, which may be included in the electronic device described in the foregoing embodiments; or may exist alone without being assembled into the electronic device in. The computer-readable medium carries one or more programs, and when the one or more programs are executed by one electronic device, the electronic device implements the method for identifying an animal quantity as in the foregoing embodiment.
例如,上述的电子设备可以实现如图1中所示的:步骤S110,获取预处理动物图像;步骤S120,基于动物的标记点,生成与预处理动物图像尺寸相同的数字矩阵;步骤S130,将数字矩阵与预设的训练矩阵进行对比,基于对比获得的对比结果,生成动物数量识别模型;步骤S140,基于动物数量识别模型实现图像中动物数量的识别。For example, the above electronic device may implement as shown in FIG. 1: step S110, obtaining a pre-processed animal image; step S120, generating a digital matrix having the same size as the pre-processed animal image based on the marked points of the animal; The number matrix is compared with a preset training matrix, and an animal number recognition model is generated based on the comparison result obtained by the comparison; step S140, the number of animals in the image is recognized based on the animal number recognition model.
又如,上述的电子设备可以实现如图3所示的各个步骤。As another example, the above electronic device can implement each step shown in FIG. 3.
应当注意,尽管在上文详细描述中提及了用于动作执行的设备的若干模块或者单元,但是这种划分并非强制性的。实际上,根据本公开的实施方式,上文描述的两个或更多模块或者单元的特征和功能可以在一个模块或者单元中具体化。反之,上文描述的一个模块或者单元的特征和功能可以进一步划分为由多个模块或者单元来具体化。It should be noted that although several modules or units of the device for action execution are mentioned in the detailed description above, this division is not mandatory. In fact, according to the embodiments of the present disclosure, the features and functions of two or more modules or units described above may be embodied in one module or unit. Conversely, the features and functions of a module or unit described above can be further divided into multiple modules or units to be embodied.
通过以上的实施方式的描述,本领域的技术人员易于理解,这里描述的示例实施方式可以通过软件实现,也可以通过软件结合必要的硬件的方式来实现。因此,根据本公开实施方式的技术方案可以以软件产品的形式体现出来,该软件产品可以存储在一个非易失性存储介质(可以是CD-ROM,U盘,移动硬盘等)中或网络上,包括若干指令以使得一台计算设备(可以是个人计算机、服务器、触控终端、或者网络设备等)执行根据本公开实施方式的方法。Through the description of the above embodiments, those skilled in the art can easily understand that the example embodiments described herein can be implemented by software, or by software in combination with necessary hardware. Therefore, the technical solution according to the embodiment of the present disclosure may be embodied in the form of a software product, which may be stored in a non-volatile storage medium (which may be a CD-ROM, a U disk, a mobile hard disk, etc.) or on a network It includes several instructions to enable a computing device (which may be a personal computer, a server, a touch terminal, or a network device, etc.) to execute the method according to the embodiment of the present disclosure.
本领域技术人员在考虑说明书及实践这里公开的发明后,将容易想到本公开的其它实施方案。本申请旨在涵盖本公开的任何变型、用途或者适应性变化,这些变型、用途或者适应性变化遵循本公开的一般性原理并包括本公开未公开的本技术领域中的公知常识或惯用技术手段。说明书和实施例仅被视为示例性的,本公开的真正范围和精神由下面的权利要求指出。Those skilled in the art will readily contemplate other embodiments of the present disclosure after considering the specification and practicing the invention disclosed herein. This application is intended to cover any variations, uses, or adaptations of this disclosure that conform to the general principles of this disclosure and include the common general knowledge or conventional technical means in the technical field not disclosed by this disclosure. . It is intended that the specification and examples be considered as exemplary only, with a true scope and spirit of the disclosure being indicated by the following claims.
应当理解的是,本公开并不局限于上面已经描述并在附图中示出的精确结构,并且可以在不脱离其范围进行各种修改和改变。本公开的范围仅由所附的权利要求来限制。It should be understood that the present disclosure is not limited to the precise structure that has been described above and illustrated in the accompanying drawings, and various modifications and changes may be made without departing from the scope thereof. The scope of the disclosure is limited only by the following claims.

Claims (10)

  1. 一种动物数量识别方法,其特征在于,包括:An animal number identification method, comprising:
    获取预处理动物图像,其中,所述预处理动物图像包括动物和所述动物的标记点;Obtaining a pre-processed animal image, wherein the pre-processed animal image includes an animal and a marker point of the animal;
    基于所述动物的标记点,生成与所述预处理动物图像尺寸相同的数字矩阵;Generating a digital matrix having the same size as the pre-processed animal image based on the marked points of the animal;
    将所述数字矩阵与预设的训练矩阵进行对比,基于所述对比获得的对比结果,生成动物数量识别模型;Comparing the number matrix with a preset training matrix, and generating an animal number recognition model based on the comparison result obtained by the comparison;
    基于所述动物数量识别模型实现图像中动物数量的识别。The identification of the number of animals in the image is realized based on the animal number recognition model.
  2. 根据权利要求1所述的动物数量识别方法,其特征在于,所述基于所述动物的标记点,生成与所述预处理动物图像尺寸相同的数字矩阵,包括:The method for identifying the number of animals according to claim 1, wherein the generating a digital matrix of the same size as the pre-processed animal image based on the marked points of the animal, comprising:
    根据所述动物的标记点确定出所述标记点在所述预处理动物图像的位置坐标;Determining a position coordinate of the marked point in the pre-processed animal image according to the marked point of the animal;
    生成与所述预处理动物图像相同尺寸的数字矩阵,其中,所述数字矩阵由0至1范围内的数字构成;Generating a digital matrix of the same size as the pre-processed animal image, wherein the digital matrix is composed of numbers in the range of 0 to 1;
    基于所述位置坐标在所述数字矩阵中确定出对应的位置,并以数字1表示所述位置坐标对应的标记点,所述数字矩阵中剩余位置以0进行表示,并使用预设的高斯核函数进行高斯模糊处理,获得与所述预处理动物图像对应的数字矩阵。A corresponding position is determined in the digital matrix based on the position coordinates, and a marked point corresponding to the position coordinate is represented by the number 1, the remaining positions in the digital matrix are represented by 0, and a preset Gaussian kernel is used The function performs Gaussian blur processing to obtain a digital matrix corresponding to the pre-processed animal image.
  3. 根据权利要求1所述的动物数量识别方法,其特征在于,所述将所述数字矩阵与预设的训练矩阵进行对比,基于所述对比获得的对比结果,生成动物数量识别模型,包括:The animal number recognition method according to claim 1, wherein the comparing the number matrix with a preset training matrix, and generating an animal number recognition model based on the comparison result obtained by the comparison, comprises:
    根据预设的卷积规则,对所述数字矩阵进行运算,获得卷积矩阵;Operate the digital matrix according to a preset convolution rule to obtain a convolution matrix;
    将所述卷积矩阵与所述预设的训练矩阵进行比对,获得比对结果;Comparing the convolution matrix with the preset training matrix to obtain a comparison result;
    根据所述比对结果,对预设的识别模型进行修正;Correct the preset recognition model according to the comparison result;
    对所修正后的识别模型进行识别准确率验证,当所述识别模型的识别准确率大于等于预设的阈值时,生成动物数量识别模型。The recognition accuracy rate of the modified recognition model is verified. When the recognition accuracy rate of the recognition model is greater than or equal to a preset threshold, an animal number recognition model is generated.
  4. 根据权利要求3所述的动物数量识别方法,其特征在于,所述基于所述动物数量识别模型实现动物数量的识别,包括:The method for identifying the number of animals according to claim 3, wherein the identifying the number of animals based on the animal number recognition model comprises:
    将所获取的待识别动物数量图像输入所述动物数量识别模型,获取所述待识别动物数量图像对应的数字矩阵;Input the acquired image of the number of animals to be identified into the animal number recognition model, and obtain a digital matrix corresponding to the image of the number of animals to be identified;
    对所述数字矩阵进行求和,获得所述待识别动物数量图像中动物的数量。Sum the digital matrix to obtain the number of animals in the image of the number of animals to be identified.
  5. 一种动物数量识别装置,其特征在于,所述装置包括:获取模块、第一生成模块、第二生成模块、识别模块;其中,An animal quantity identification device, characterized in that the device includes: an acquisition module, a first generation module, a second generation module, and an identification module; wherein,
    获取模块,用于获取预处理动物图像,其中,所述预处理动物图像包括动物和所述动物的标记点;An acquisition module for acquiring a pre-processed animal image, wherein the pre-processed animal image includes an animal and a marker point of the animal;
    第一生成模块,用于基于所述动物的标记点,生成与所述预处理动物图像尺寸相同的数字矩阵;A first generating module, configured to generate a digital matrix having the same size as the pre-processed animal image based on the marked points of the animal;
    第二生成模块,用于将所述数字矩阵与预设的训练矩阵进行对比,基于所述对比获得的对比结果,生成动物数量识别模型;A second generating module, configured to compare the digital matrix with a preset training matrix, and generate an animal number recognition model based on the comparison result obtained by the comparison;
    识别模块,用于基于所述动物数量识别模型实现图像中动物数量的识别。A recognition module is configured to recognize the number of animals in an image based on the animal number recognition model.
  6. 根据权利要求5所述的动物数量识别装置,其特征在于,所述第一生成模块具体用于:The apparatus for identifying an animal quantity according to claim 5, wherein the first generating module is specifically configured to:
    根据所述动物的标记点确定出所述标记点在所述预处理动物图像的位置坐标;Determining a position coordinate of the marked point in the pre-processed animal image according to the marked point of the animal;
    生成与所述预处理动物图像相同尺寸的数字矩阵,其中,所述数字矩阵由0至1范围内的数字构成;Generating a digital matrix of the same size as the pre-processed animal image, wherein the digital matrix is composed of numbers in the range of 0 to 1;
    基于所述位置坐标在所述数字矩阵中确定出对应的位置,并以数字1表示所述位置坐标对应的标记点,所述数字矩阵中剩余位置以0进行表示,并使用预设的高斯核函数进行高斯模糊处理,获得与所述预处理动物图像对应的数字矩阵。A corresponding position is determined in the digital matrix based on the position coordinates, and a marked point corresponding to the position coordinate is represented by the number 1, the remaining positions in the digital matrix are represented by 0, and a preset Gaussian kernel is used The function performs Gaussian blur processing to obtain a digital matrix corresponding to the pre-processed animal image.
  7. 根据权利要求5所述的动物数量识别装置,其特征在于,所述第二识别模块具体用于:The animal number recognition device according to claim 5, wherein the second recognition module is specifically configured to:
    根据预设的卷积规则,对所述数字矩阵进行运算,获得卷积矩阵;Operate the digital matrix according to a preset convolution rule to obtain a convolution matrix;
    将所述卷积矩阵与所述预设的训练矩阵进行比对,获得比对结果;Comparing the convolution matrix with the preset training matrix to obtain a comparison result;
    根据所述比对结果,对预设的识别模型进行修正;Correct the preset recognition model according to the comparison result;
    对所修正后的识别模型进行识别准确率验证,当所述识别模型的识别准确率大于等于预设的阈值时,生成动物数量识别模型。The recognition accuracy rate of the modified recognition model is verified. When the recognition accuracy rate of the recognition model is greater than or equal to a preset threshold, an animal number recognition model is generated.
  8. 根据权利要求7所述的动物数量识别装置,其特征在于,所述第二识别模块还具体用于:The animal number recognition device according to claim 7, wherein the second recognition module is further configured to:
    将所获取的待识别动物数量图像输入所述动物数量识别模型,获取所述待识别动物数量图像对应的数字矩阵;Input the acquired image of the number of animals to be identified into the animal number recognition model, and obtain a digital matrix corresponding to the image of the number of animals to be identified;
    对所述数字矩阵进行求和,获得所述待识别动物数量图像中动物的数量。Sum the digital matrix to obtain the number of animals in the image of the number of animals to be identified.
  9. 一种计算机可读介质,其上存储有计算机程序,其特征在于,所述程序被处理器执行时实现权利要求1至7中任一项所述的动物数量识别方法。A computer-readable medium having stored thereon a computer program, characterized in that when the program is executed by a processor, the method for identifying an animal quantity according to any one of claims 1 to 7 is implemented.
  10. 一种电子设备,其特征在于,包括:An electronic device, comprising:
    一个或多个处理器;One or more processors;
    存储装置,用于存储一个或多个程序,当所述一个或多个程序被所述一个或多个处理器执行时,使得所述一个或多个处理器实现权利要求1至7中任一所述的动物数量识别方法。A storage device, configured to store one or more programs, and when the one or more programs are executed by the one or more processors, cause the one or more processors to implement any one of claims 1 to 7 The animal number identification method.
PCT/CN2019/099817 2018-08-10 2019-08-08 Animal count identification method, device, medium, and electronic apparatus WO2020030052A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201810907165.5A CN110826581B (en) 2018-08-10 2018-08-10 Animal number identification method, device, medium and electronic equipment
CN201810907165.5 2018-08-10

Publications (1)

Publication Number Publication Date
WO2020030052A1 true WO2020030052A1 (en) 2020-02-13

Family

ID=69413981

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2019/099817 WO2020030052A1 (en) 2018-08-10 2019-08-08 Animal count identification method, device, medium, and electronic apparatus

Country Status (2)

Country Link
CN (1) CN110826581B (en)
WO (1) WO2020030052A1 (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111582778A (en) * 2020-04-17 2020-08-25 上海中通吉网络技术有限公司 Operation site cargo accumulation measuring method, device, equipment and storage medium
CN111898682A (en) * 2020-07-31 2020-11-06 平安科技(深圳)有限公司 Method and device for correcting new model based on multiple source models and computer equipment

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112016740A (en) * 2020-08-18 2020-12-01 北京海益同展信息科技有限公司 Data processing method and device
CN112241466A (en) * 2020-09-22 2021-01-19 天津永兴泰科技股份有限公司 Wild animal protection law recommendation system based on animal identification map
CN114494863A (en) * 2022-01-12 2022-05-13 北京小龙潜行科技有限公司 Animal cub counting method and device based on Blend Mask algorithm

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20110114029A1 (en) * 2009-11-17 2011-05-19 Chu Chien-Hung Aquatic-animal counting system, aquatic-animal counting method, and recording medium
CN102436656A (en) * 2011-09-05 2012-05-02 同济大学 Animal-diversity monitoring method based on computer vision
CN106023231A (en) * 2016-06-07 2016-10-12 首都师范大学 Method for automatically detecting cattle and sheep in high resolution image
CN107330403A (en) * 2017-06-30 2017-11-07 四川省草原科学研究院 A kind of yak method of counting based on video data

Family Cites Families (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2011020145A1 (en) * 2009-08-19 2011-02-24 The University Of New England System and method for monitoring the feeding practices of individual animals in a grazing environment
JP5776255B2 (en) * 2011-03-25 2015-09-09 ソニー株式会社 Terminal device, object identification method, program, and object identification system
CN102542289B (en) * 2011-12-16 2014-06-04 重庆邮电大学 Pedestrian volume statistical method based on plurality of Gaussian counting models
CN103295031B (en) * 2013-04-15 2016-12-28 浙江大学 A kind of image object method of counting based on canonical risk minimization
CN105528587B (en) * 2015-12-29 2019-04-30 生迪智慧科技有限公司 The method and device of target detection
CN107330472A (en) * 2017-07-06 2017-11-07 南开大学 A kind of automatic identifying method of unmarked model animal individual
CN108171274B (en) * 2018-01-17 2019-08-09 百度在线网络技术(北京)有限公司 The method and apparatus of animal for identification

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20110114029A1 (en) * 2009-11-17 2011-05-19 Chu Chien-Hung Aquatic-animal counting system, aquatic-animal counting method, and recording medium
CN102436656A (en) * 2011-09-05 2012-05-02 同济大学 Animal-diversity monitoring method based on computer vision
CN106023231A (en) * 2016-06-07 2016-10-12 首都师范大学 Method for automatically detecting cattle and sheep in high resolution image
CN107330403A (en) * 2017-06-30 2017-11-07 四川省草原科学研究院 A kind of yak method of counting based on video data

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
LIANG, YANSEN ET AL.: "A Remote . . Image Acquisition and Target Counting System for Livestock Farm", JOURNAL OF CUILIN UNIVERSITY OF ELECTRONIC TECHNOLOGY, vol. 37, no. 6, 31 December 2017 (2017-12-31), pages 437 - 441 *

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111582778A (en) * 2020-04-17 2020-08-25 上海中通吉网络技术有限公司 Operation site cargo accumulation measuring method, device, equipment and storage medium
CN111582778B (en) * 2020-04-17 2024-04-12 上海中通吉网络技术有限公司 Method, device, equipment and storage medium for measuring accumulation of cargos in operation site
CN111898682A (en) * 2020-07-31 2020-11-06 平安科技(深圳)有限公司 Method and device for correcting new model based on multiple source models and computer equipment
CN111898682B (en) * 2020-07-31 2023-08-25 平安科技(深圳)有限公司 Method and device for correcting new model based on multiple source models and computer equipment

Also Published As

Publication number Publication date
CN110826581A (en) 2020-02-21
CN110826581B (en) 2023-11-07

Similar Documents

Publication Publication Date Title
WO2020030052A1 (en) Animal count identification method, device, medium, and electronic apparatus
CN108229489B (en) Key point prediction method, network training method, image processing method, device and electronic equipment
TWI742382B (en) Neural network system for vehicle parts recognition executed by computer, method for vehicle part recognition through neural network system, device and computing equipment for vehicle part recognition
US11436739B2 (en) Method, apparatus, and storage medium for processing video image
CN114332135B (en) Semi-supervised medical image segmentation method and device based on dual-model interactive learning
CN110245579B (en) People flow density prediction method and device, computer equipment and readable medium
US11688077B2 (en) Adaptive object tracking policy
CN112052948B (en) Network model compression method and device, storage medium and electronic equipment
CN111914613B (en) Multi-target tracking and facial feature information recognition method
CN108229675B (en) Neural network training method, object detection method, device and electronic equipment
CN111052128B (en) Descriptor learning method for detecting and locating objects in video
CN111079837B (en) Method for detecting, identifying and classifying two-dimensional gray level images
WO2022111387A1 (en) Data processing method and related apparatus
CN112668608B (en) Image recognition method and device, electronic equipment and storage medium
CN113902256A (en) Method for training label prediction model, label prediction method and device
WO2023207389A1 (en) Data processing method and apparatus, program product, computer device, and medium
CN113569852A (en) Training method and device of semantic segmentation model, electronic equipment and storage medium
CN113298152A (en) Model training method and device, terminal equipment and computer readable storage medium
WO2023123926A1 (en) Artificial intelligence task processing method and apparatus, electronic device, and readable storage medium
CN115082752A (en) Target detection model training method, device, equipment and medium based on weak supervision
CN113326825A (en) Pseudo tag generation method and device, electronic equipment and storage medium
CN111428567B (en) Pedestrian tracking system and method based on affine multitask regression
CN113822144A (en) Target detection method and device, computer equipment and storage medium
WO2021068249A1 (en) Method and apparatus for hardware simulation and emulation during running, and device and storage medium
CN114550307B (en) Motion positioning model training method and device and motion positioning method

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 19847723

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 19847723

Country of ref document: EP

Kind code of ref document: A1