A computer program for training a detection model, the computer program causing a computer to execute a process comprising: training a feature model, which calculates a feature value of an input image, on a plurality of first images, wherein each first image contains an object that belongs to one of a plurality of classes; the plurality of first images are generated by cropping, from a third image with attached training information that indicate regions with objects and a class to which each of the objects belongs, the regions being indicated by the training information; and each first image contains less background than the object desired to be detected; calculating, using the feature model, first feature values corresponding one-to-one with the plurality of first images, and generating feature distribution information representing the distribution of first feature values for each class in the plurality of classes; and training, on a plurality of second images, a detection model, which determines, in an input image, each region with an object and a class to which the object belongs, wherein the training of the detection model includes: calculating, for each region determined by the detection model within the plurality of second images, a second feature value using the feature model; calculating a distance between the second feature value and an average of the first feature values belonging to a class determined by the detection model by using the feature distribution information; modifying an evaluation value, which indicates class determination accuracy of the detection model, such that evaluation of the class determination accuracy is reduced further when the calculated distance is larger; and updating the detection model to improve the modified evaluation value. training a feature model, which calculates a feature value of an input image, on a plurality of first images, wherein each first image contains an object that belongs to one of a plurality of classes; the plurality of first images are generated by cropping, from a third image with attached training information that indicate regions with objects and a class to which each of the objects belongs, the regions being indicated by the training information; and each first image contains less background than the object desired to be detected; each first image contains an object that belongs to one of a plurality of classes; the plurality of first images are generated by cropping, from a third image with attached training information that indicate regions with objects and a class to which each of the objects belongs, the regions being indicated by the training information; and each first image contains less background than the object desired to be detected; calculating, using the feature model, first feature values corresponding one-to-one with the plurality of first images, and generating feature distribution information representing the distribution of first feature values for each class in the plurality of classes; and training, on a plurality of second images, a detection model, which determines, in an input image, each region with an object and a class to which the object belongs, wherein the training of the detection model includes: calculating, for each region determined by the detection model within the plurality of second images, a second feature value using the feature model; calculating a distance between the second feature value and an average of the first feature values belonging to a class determined by the detection model by using the feature distribution information; modifying an evaluation value, which indicates class determination accuracy of the detection model, such that evaluation of the class determination accuracy is reduced further when the calculated distance is larger; and updating the detection model to improve the modified evaluation value. calculating, for each region determined by the detection model within the plurality of second images, a second feature value using the feature model; calculating a distance between the second feature value and an average of the first feature values belonging to a class determined by the detection model by using the feature distribution information; modifying an evaluation value, which indicates class determination accuracy of the detection model, such that evaluation of the class determination accuracy is reduced further when the calculated distance is larger; and updating the detection model to improve the modified evaluation value.