A method for detecting mounting behavior of an animal object by using an apparatus for detecting mounting behavior of an animal object based on an image, comprising:
- a process of extracting animal detection information by inputting an image of a target object into an animal detection model that is trained based on learning data composed of animal images, the animal detection information including a bounding box created to be suitable for the animal object, coordinates of a central point of the bounding box, a width of the bounding box, a length of the bounding box, a rotational angle of the bounding box with respect to a reference axis, a position of the end of the head of the animal object, a position of the neck and a position of the end of the body;
- a process of extracting, from the received image, bounding boxes of which a distance between the coordinates of the central points is smaller than a first set value;
- a process of extracting, from the extracted bounding boxes, bounding boxes of which a difference in rotational angle is smaller than a second set value;
- a process of extracting bounding boxes of which a difference between a vector connecting the central points of the extracted bounding boxes and an orientation of each bounding box is smaller than a third set value;
- and
- a process of extracting activity information of the animal object based on a motion history image (MHI) of the image from which the extracted bounding boxes are detected, and
- if the activity information of the animal object is extracted, it is determined that mounting behavior occurs in an animal object specified by the bounding boxes, and
- wherein the process of extracting activity information of the animal object based on MHI includes:
- a process of sequentially generating difference images for a time point t (t is a natural number of 1 or more) by calculating a difference in pixel brightness between an image converted into a monochrome image at a time point t−1 and an image converted into a monochrome image at the time point t for each pixel, converting a corresponding pixel value into an upper limit when the calculated difference in pixel brightness is equal to or greater than a fifth set value and converting a corresponding pixel value into a lower limit when the calculated difference in pixel brightness is smaller than the fifth set value;
- a process of converting a corresponding pixel value into the upper limit when a difference between a pixel brightness of a difference image for a time point t+1 and a pixel brightness of a difference image for the time point t is equal to or greater than the fifth set value;
- a process of storing a difference between a pixel brightness of a difference image for the time point t and a sixth set value as a corresponding pixel value when a difference between a pixel brightness of a difference image for a time point t+1 and the pixel brightness of the difference image for the time point t is smaller than the fifth set value and the pixel brightness of the difference image for the time point t is equal to or greater than the fifth set value;
- a process of converting a pixel brightness of a difference image for the time point t into the lower limit to generate each MHI for the time point t+1 when a difference between a pixel brightness of a difference image for a time point t+1 and the pixel brightness of the difference image for the time point t is smaller than the fifth set value and the pixel brightness of the difference image for the time point t is smaller than the fifth set value;
- and
- a process of extracting a feature map from each MHI.