Detection method, imaging apparatus, and program
There is provided a detection method used in an imaging apparatus including an imaging element that has a first pixel for generating a first signal and second and third pixels for generating second and third signals for detecting a phase difference, and a memory that stores a machine-trained model, the detection method including: an input step of inputting a second image based on the second signal, a third image based on the third signal, or a fourth image based on the second signal and the third signal to the model as an input image; a subject detection step of detecting a subject included in a first image generated by the first signal, through the model on which the input step is executed; and a focusing position detection step of detecting a focusing position with respect to the subject, through the model on which the input step is executed.
1 . A detection method used in an imaging apparatus including an imaging element that has a first pixel for generating a first signal and second and third pixels for generating second and third signals for detecting a phase difference, and a memory that stores a plurality of models trained through machine learning, the detection method comprising:
a selection step of selecting one model, among the plurality of models, based on a type of phase difference detection of the second pixel and the third pixel;
an input step of inputting a second image based on the second signal, a third image based on the third signal, or a fourth image based on the second signal and the third signal to the selected model as an input image;
a subject detection step of detecting a subject included in a first image generated by the first signal, through the selected model on which the input step is executed; and
a first focusing position detection step of detecting a focusing position with respect to the subject, through the selected model on which the input step is executed.
2 . The detection method according to claim 1 , further comprising:
a second focusing position detection step of detecting the focusing position with respect to the subject by performing correlation operation using the second signal and the third signal.
3 . The detection method according to claim 2 ,
wherein the first focusing position detection step is executed according to a result of the second focusing position detection step or the subject detection step.
4 . The detection method according to claim 1 ,
wherein, in the input step, the input image is rotated and input to the selected model, and
in the first focusing position detection step, the focusing position is detected based on the rotated input image.
5 . The detection method according to claim 1 , further comprising:
a first readout step of reading out the first signal from the first pixel; and
a second readout step of reading out the second signal and the third signal from the second pixel and the third pixel, independently of the first readout step.
6 . The detection method according to claim 5 ,
wherein an exposure amount of the second pixel and the third pixel read out in the second readout step is different from an exposure amount of the first pixel read out in the first readout step.
7 . The detection method according to claim 6 ,
wherein a readout rate of the second signal and the third signal in the second readout step is higher than a readout rate of the first signal in the first readout step.
8 . The detection method according to claim 1 ,
wherein, in the input step, any of the second image or the third image is input to the selected model as the input image based on a position of the subject detected in the subject detection step in a past.
9 . The detection method according to claim 1 ,
wherein the input image in the input step is the fourth image.
10 . The detection method according to claim 1 ,
wherein, in a case where a phase difference detection direction of the second pixel and the third pixel is a horizontal direction,
the selected model
executes horizontal pooling and vertical pooling on the input image in the subject detection step, and
executes horizontal pooling on the input image in the first focusing position detection step.
11 . The detection method according to claim 1 ,
wherein the type of phase difference detection includes a phase difference detection direction of the second pixel and the third pixel, and
wherein the selection step includes selecting, from among the plurality of models, a model suitable for the phase difference detection direction.
12 . An imaging apparatus comprising:
an imaging element that has a first pixel for generating a first signal and second and third pixels for generating second and third signals for detecting a phase difference;
a memory that stores a plurality of models trained through machine learning; and
a processor,
wherein the processor is configured to execute:
a selection process of selecting one model, among the plurality of models, based on a type of phase difference detection of the second pixel and the third pixel;
an input process of inputting a second image based on the second signal, a third image based on the third signal, or a fourth image based on the second signal and the third signal to the selected model as an input image;
a subject detection process of detecting a subject included in a first image generated by the first signal, through the selected model on which the input process is executed; and
a first focusing position detection process of detecting a focusing position with respect to the subject, through the selected model on which the input process is executed.
13 . A non-transitory computer recording medium storing a program for operating an imaging apparatus including an imaging element that has a first pixel for generating a first signal and second and third pixels for generating second and third signals for detecting a phase difference, and a memory that stores a plurality of models trained through machine learning, the program causing the imaging apparatus to execute:
a selection process of selecting one model, among the plurality of models, based on a type of phase difference detection of the second pixel and the third pixel;
an input process of inputting a second image based on the second signal, a third image based on the third signal, or a fourth image based on the second signal and the third signal to the selected model as an input image;
a subject detection process of detecting a subject included in a first image generated by the first signal, through the selected model on which the input process is executed; and
a first focusing position detection process of detecting a focusing position with respect to the subject, through the selected model on which the input process is executed.