This invention relates to a method and apparatus for
object detection and determining training samples for
object detection. The method, when dividing positive and negative samples, determines positive samples of target boxes based on the
aspect ratio of the target boxes in the training image. Furthermore, when the
aspect ratio of a target box is large, a first preset threshold inversely proportional to the
aspect ratio is set. This results in a smaller first preset threshold when the aspect ratio of the target box is large. Using the intersection-union ratio (IUU) of candidate boxes and target boxes, along with the first preset threshold, can also effectively determine whether a candidate box is a
positive sample, avoiding missed detections. This lays the foundation for training an
object detection model based on positive and negative samples of target boxes in the training image. The trained object detection model can better learn the position and feature information of the object to be detected, reducing the missed
detection rate of objects with large aspect ratios, thereby improving the accuracy of object detection.