Inference device, imaging device, learning device, inference method, learning method, and program
The imaging device uses a machine learning model to infer and suppress irrelevant distance information from focus detection areas, enhancing focus accuracy by excluding obstructions and errors, thus improving focus detection in challenging conditions.
Patent Information
- Application Number
- JP2023024624
- Authority / Receiving Office
- JP · JP
- Patent Type
- Applications
- Current Assignee / Owner
- Filing Date
- 2023-02-20
- Publication Date
- 2024-08-30
AI Technical Summary
Existing focus detection technologies struggle to accurately focus on subjects when obstructions or low-contrast conditions interfere, leading to errors in focus detection results.
An imaging device employs a machine learning model to infer distance information based on multiple focus detection areas, suppressing the contribution of distance information not based on the subject, such as obstructions or large errors, to enhance focus accuracy.
The method improves focus detection accuracy by excluding irrelevant or erroneous distance information, allowing for precise focus control even in challenging conditions like obstructions or low-contrast environments.
Smart Images

Figure 2024118274000001
Abstract
Description
[Technical Field]
[0001] The present invention relates to an inference device, an imaging device, a learning device, an inference method, a learning method, and a program. [Background technology]
[0002] There is known an imaging device that performs focus adjustment to focus on a subject by detecting distance information such as defocus amounts from each of multiple focus detection areas within a subject area that includes the subject. Patent Document 1 discloses a technology for focusing on a main subject while eliminating the influence of an obstruction that may cross in front of the main subject. According to Patent Document 1, the focus adjustment device determines the area of an obstruction that may cross in front of the main subject by using statistics of distance values corresponding to the subject distances of multiple autofocus (AF) areas. [Prior art documents] [Patent documents]
[0003] [Patent Document 1] Japanese Patent Publication No. 2022-137760 Summary of the Invention [Problem to be solved by the invention]
[0004] For example, in a situation where a user wants to focus on a person's face, the person's arms or hands may cover the face. For example, when the arms cover the face, the face area will include an area where the face does not exist (i.e., the area of the arms covering the face), and the focus detection result in the face area will change continuously from the face to the arms. In such a case, it is difficult for the technology of Patent Document 1 to suppress the influence of the arms and focus on the face.
[0005] Furthermore, for example, when shooting in a low-light environment, when the subject has little contrast, or when the F-number of the shooting optical system is large, the variation in focus detection results is likely to be large. Therefore, focus detection results within the subject area may include focus detection results with relatively large errors. In such cases, errors in focus detection results occur according to a predetermined distribution such as a normal distribution, making it difficult for the technology of Patent Document 1, which uses statistical values, to suppress the influence of focus detection results with errors.
[0006] The present invention has been made in light of these circumstances, and aims to provide a technology that suppresses the contribution of distance information that is not based on the subject (for example, distance information corresponding to an obstruction or distance information with a relatively large detection error) when using multiple pieces of distance information detected from multiple focus detection areas within a subject area. [Means for solving the problem]
[0007] In order to solve the above problem, the present invention provides an inference device that includes an inference means that performs inference using a machine learning model based on a subject area in an image obtained by shooting that includes a subject and multiple distance information detected from multiple focus detection areas within the subject area, and generates an inference result that indicates distance information corresponding to the subject or a range of distance information corresponding to the subject, and is characterized in that the machine learning model is a model that has been trained to suppress the contribution of one or more distance information among the multiple distance information that is not based on the subject to the inference result. [Effects of the Invention]
[0008] According to the present invention, when using multiple distance information detected from multiple focus detection areas within a subject area, it is possible to suppress the contribution of distance information that is not based on the subject (for example, distance information corresponding to an obstruction or distance information with a relatively large detection error).
[0009] Other features and advantages of the present invention will become more apparent from the accompanying drawings and the following detailed description of the preferred embodiment of the present invention. [Brief explanation of the drawings]
[0010] [Figure 1] FIG. 1 is a block diagram of an imaging device 10 including an inference device. [Figure 2] 3 is a schematic diagram of an array of imaging pixels and focus detection pixels of an image sensor 122. [Figure 3] 3(a) is a plan view of one pixel 200G of the image sensor 122 as viewed from the light receiving surface side (+z side) of the image sensor 122, and FIG. 3(b) is a cross-sectional view of the aa cross section of FIG. 3(a) as viewed from the -y side. [Figure 4] FIG. 4 is a schematic explanatory diagram showing the correspondence between the pixel structure shown in FIG. 3 and pupil division. [Figure 5] FIG. 3 is a schematic diagram showing the correspondence between the image sensor 122 and pupil division. [Figure 6] 10 is a diagram showing a schematic relationship between the defocus amount corresponding to the first focus detection signal and the second focus detection signal acquired by the image sensor 122 and the image shift amount between the first focus detection signal and the second focus detection signal. FIG. [Figure 7] FIG. 2 is a diagram showing details of a subject detection unit 130. [Figure 8] 10 is a diagram showing an example in which the user selects, from a menu screen displayed on the display unit 126, the type of subject to be preferentially detected and whether or not to perform local region detection. FIG. [Figure 9] 4 is a flowchart of a photographing process executed by the imaging device 10. [Figure 10] 1 is a schematic diagram illustrating the relationship between a subject and an area including the subject. [Figure 11] 10 is a flowchart showing details of focus adjustment processing (S903). [Figure 12] FIG. 11 is a diagram showing an example of a focus detection area set in step S1102. [Figure 13] FIG. 13 is a diagram showing a histogram of the defocus amount included in the defocus map (the portion corresponding to the area 1014 in FIG. 12) input when estimating the defocus range. [Figure 14]FIG. 10 is a diagram showing a focus detection area extracted based on the defocus range for each part of a subject from the input range (area 1014) of the defocus map. [Figure 15] FIG. 3 is a diagram showing details of a defocus range inferring unit 132. [Figure 16] FIG. 16 shows the configuration of a learning device 1600. [Figure 17] FIG. 4 is a diagram for explaining an example of the effect of the first embodiment. [Figure 18] 10A and 10B are diagrams illustrating a first modification of a method for utilizing the defocus range inferred by the defocus range inferring unit 132. [Figure 19] 10A and 10B are diagrams illustrating a first modification of a method for utilizing the defocus range inferred by the defocus range inferring unit 132. DETAILED DESCRIPTION OF THE INVENTION
[0011] Hereinafter, embodiments will be described in detail with reference to the accompanying drawings. Note that the following embodiments do not limit the scope of the invention claimed. Although multiple features are described in the embodiments, not all of these multiple features are necessarily essential to the invention, and multiple features may be combined arbitrarily. Furthermore, in the accompanying drawings, the same reference numerals are used to designate the same or similar components, and redundant explanations will be omitted.
[0012] [First embodiment] Configuration of the imaging device 10 FIG. 1 is a block diagram of an imaging device 10 (a single-lens reflex digital camera with interchangeable lenses) that includes an inference device. The imaging device 10 is a camera system having a lens unit 100 (interchangeable lens) and a camera body 120. The lens unit 100 is detachably attached to the camera body 120 via a mount M, which is indicated by a dotted line in FIG. 1. However, this embodiment is not limited to this configuration and can also be applied to an imaging device (digital camera) in which the lens unit (imaging optical system) and the camera body are integrated. Furthermore, this embodiment is not limited to digital cameras and can also be applied to other imaging devices, such as video cameras.
[0013] Lens unit 100 has an optical system consisting of a first lens group 101, an aperture 102, a second lens group 103, a focus lens group (hereinafter simply referred to as "focus lens 104"), and a drive / control system. As such, lens unit 100 is a photographing lens (image pickup optical system) that includes focus lens 104 and forms a subject image.
[0014] The first lens group 101 is disposed at the tip of the lens unit 100 and is held so as to be able to move back and forth in the optical axis direction OA. The diaphragm 102 adjusts the amount of light during shooting by adjusting its aperture diameter, and also functions as a shutter for adjusting the exposure time during still image shooting. The diaphragm 102 and the second lens group 103 are movable together in the optical axis direction OA, and a zoom function is achieved in conjunction with the forward and backward movement of the first lens group 101. The focus lens 104 is movable in the optical axis direction OA, and the subject distance (focusing distance) at which the lens unit 100 focuses changes depending on its position. Controlling the position of the focus lens 104 in the optical axis direction OA enables focus adjustment (focus control) to adjust the focusing distance of the lens unit 100.
[0015] The drive / control system includes a zoom actuator 111, an aperture actuator 112, a focus actuator 113, a zoom drive circuit 114, an aperture drive circuit 115, a focus drive circuit 116, a lens MPU 117, and a lens memory 118. The zoom drive circuit 114 uses the zoom actuator 111 to drive the first lens group 101 and the second lens group 103 in the optical axis direction OA, thereby controlling the angle of view of the optical system of the lens unit 100 (performing a zoom operation). The aperture drive circuit 115 uses the aperture actuator 112 to drive the aperture 102, thereby controlling the aperture diameter and opening / closing operation of the aperture 102. The focus drive circuit 116 uses the focus actuator 113 to drive the focus lens 104 in the optical axis direction OA, thereby controlling the focal length of the optical system of the lens unit 100 (performing focus control). The focus drive circuit 116 also functions as a position detector that detects the current position (lens position) of the focus lens 104 using the focus actuator 113.
[0016] The lens MPU 117 (processor) performs calculations and controls related to the operation of the lens unit 100, and controls the zoom drive circuit 114, the aperture drive circuit 115, and the focus drive circuit 116. The lens MPU 117 is also connected to the camera MPU 125 via the mount M to exchange commands and data. For example, the lens MPU 117 detects the position of the focus lens 104 and notifies the camera MPU 125 of lens position information in response to a request. This lens position information includes information such as the position of the focus lens 104 in the optical axis direction OA, the position and diameter of the exit pupil in the optical axis direction OA when the optical system is not moving, and the position and diameter of the lens frame that limits the light beam of the exit pupil in the optical axis direction OA. The lens MPU 117 also controls the zoom drive circuit 114, the aperture drive circuit 115, and the focus drive circuit 116 in response to a request from the camera MPU 125.
[0017] Lens memory 118 stores optical information necessary for automatic focus adjustment (AF control). Camera MPU 125 controls the operation of lens unit 100 by executing programs stored in, for example, an internal nonvolatile memory or lens memory 118.
[0018] The camera body 120 has an optical low-pass filter 121, an image sensor 122, and a drive / control system. The optical low-pass filter 121 and the image sensor 122 function as an imaging section that photoelectrically converts an object image (optical image) formed via the lens unit 100 and outputs image data. In this embodiment, the image sensor 122 photoelectrically converts an object image formed via the imaging optical system and outputs an imaging signal and a focus detection signal as image data. In this embodiment, the first lens group 101, the aperture 102, the second lens group 103, the focus lens 104, and the optical low-pass filter 121 constitute an imaging optical system.
[0019] The optical low-pass filter 121 reduces false colors and moiré in captured images. The image sensor 122 is composed of a CMOS image sensor and its peripheral circuits, and is arranged with m pixels in the horizontal direction and n pixels in the vertical direction (m and n are integers of 2 or greater). The image sensor 122 of this embodiment also serves as a focus detection element, has a pupil-splitting function, and has pupil-splitting pixels that are capable of phase-difference detection focus detection (phase-difference AF) using image data (image signals). The image processing circuit 124 generates data for phase-difference AF and image data for display, recording, and subject detection based on the image data output from the image sensor 122.
[0020] The drive / control system includes an image sensor drive circuit 123, an image processing circuit 124, a camera MPU 125, a display unit 126, a group of operation switches 127 (operation SW), a memory 128, a phase-difference AF unit 129, a subject detection unit 130, an AE unit 131, and a defocus range inference unit 132. The image sensor drive circuit 123 controls the operation of the image sensor 122, and also A / D-converts the image signal (image data) output from the image sensor 122 and transmits the converted image signal to the camera MPU 125. The image processing circuit 124 performs typical image processing performed in digital cameras, such as gamma conversion, color interpolation, and compression encoding, on the image signal output from the image sensor 122. The image processing circuit 124 also generates a signal for phase-difference AF, a signal for AE, and a signal for subject detection. In this embodiment, the image processing circuit 124 generates a signal for phase difference AF, a signal for AE, and a signal for subject detection, but for example, the signal for AE and the signal for subject detection may be generated as a common signal. Furthermore, the combination of common signals is not limited to this.
[0021] The camera MPU 125 (processor) performs calculations and controls related to the operation of the camera body 120. That is, the camera MPU 125 controls the image sensor drive circuit 123, the image processing circuit 124, the display unit 126, the operation switch group 127, the memory 128, the phase difference AF unit 129, the subject detection unit 130, the AE unit 131, and the defocus range inference unit 132. The camera MPU 125 is connected to the lens MPU 117 via a signal line of the mount M and exchanges commands and data with the lens MPU 117. The camera MPU 125 issues requests to the lens MPU 117 to acquire the lens position and to drive the lens by a predetermined drive amount. The camera MPU 125 also issues requests to the lens MPU 117 to acquire optical information specific to the lens unit 100.
[0022] The camera MPU 125 incorporates a ROM 125a that stores a program for controlling the operation of the camera body 120, a RAM 125b (camera memory) that stores variables, and an EEPROM 125c that stores various parameters. The camera MPU 125 also executes focus detection processing based on the program stored in the ROM 125a. In the focus detection processing, a known correlation calculation process is executed using a pair of image signals obtained by photoelectrically converting optical images formed by light beams that have passed through different pupil regions (pupil partial regions) of the imaging optical system.
[0023] The display unit 126 is composed of an LCD etc. and displays information about the shooting mode of the imaging device 10, a preview image before shooting and a confirmation image after shooting, an in-focus state display image when focus is detected, etc. The operation switch group 127 is composed of a power switch, a release (shooting trigger) switch, a zoom operation switch, a shooting mode selection switch, etc. The memory 128 is a removable flash memory and records shot images.
[0024] The phase-difference AF unit 129 performs focus detection processing using a phase-difference detection method based on focus detection image data (phase-difference AF signals) obtained from the image sensor 122 and the image processing circuit 124. More specifically, the image processing circuit 124 generates a pair of image data formed by light beams passing through a pair of pupil regions of the imaging optical system as focus detection image data. The phase-difference AF unit 129 detects the amount of focus deviation based on the amount of deviation between the pair of image data. In this way, the phase-difference AF unit 129 of this embodiment performs phase-difference AF (image-surface phase-difference AF) based on the output of the image sensor 122 without using a dedicated AF sensor. Note that at least a portion of the configuration of the phase-difference AF unit 129 may be provided in the camera MPU 125. Details of the operation of the phase-difference AF unit 129 will be described later.
[0025] The subject detection unit 130 performs subject detection processing based on a subject detection signal generated by the image processing circuit 124. The subject detection processing detects the position and size (subject detection area) of each type and state of the subject and each part of the subject. Details of the operation of the subject detection unit 130 will be described later.
[0026] The AE unit 131 performs exposure adjustment processing to set appropriate shooting conditions by performing photometry based on AE signals obtained from the image sensor 122 and the image processing circuit 124. Specifically, the AE unit 131 performs photometry based on the AE signals and calculates the amount of exposure at the currently set aperture value, shutter speed, and ISO sensitivity. The AE unit 131 performs exposure adjustment processing by calculating appropriate aperture value, shutter speed, and ISO sensitivity to be set during shooting based on the difference between the calculated exposure amount and a predetermined appropriate exposure amount, and setting these as shooting conditions.
[0027] The defocus range inference unit 132 receives as input image information including the area within the image of the subject detected by the subject detection unit 130, position information thereof, and focus detection information detected by the phase difference AF unit 129, and outputs the defocus range of the detected subject. Details of the operation of the defocus range inference unit 132 will be described later.
[0028] In this way, the imaging device 10 of this embodiment can perform a combination of phase-difference AF, photometry (exposure adjustment), and subject detection, and can select the target position (image height range) for phase-difference AF and photometry depending on the subject detection results. Also, by obtaining an inference result of the defocus range corresponding to the subject detection area, it is possible to select a correct or highly accurate focus detection result from among multiple focus detection results detected within the subject.
[0029] Configuration of the image sensor 122 FIG. 2 is a schematic diagram of the array of imaging pixels and focus detection pixels of the image sensor 122. In FIG. 2, the pixel array of the image sensor 122, which is a two-dimensional CMOS sensor, is shown as a 4-column by 4-row array, and the focus detection pixel array is shown as an 8-column by 4-row array. In the first embodiment, the 2-column by 2-row pixel group 200 shown in FIG. 2 has a pixel 200R having R (red) spectral sensitivity arranged in the upper left, pixels 200G having G (green) spectral sensitivity arranged in the upper right and lower left, and a pixel 200B having B (blue) spectral sensitivity arranged in the lower right. Furthermore, each pixel is composed of a first focus detection pixel 201 and a second focus detection pixel 202 arranged in a 2-column by 1-row array.
[0030] A large number of 4 columns x 4 rows of pixels (8 columns x 4 rows of focus detection pixels) shown in Figure 2 are arranged on a surface to enable acquisition of a captured image (focus detection signal). For example, the pixel period P is 4 μm, the number of pixels N is 5,575 columns horizontally x 3,725 rows vertically = approximately 20.75 million pixels, the column-direction period PAF of the focus detection pixels is 2 μm, and the number of focus detection pixels NAF is 11,150 columns horizontally x 3,725 rows vertically = approximately 41.5 million pixels.
[0031] Fig. 3(a) is a plan view of one pixel 200G of the imaging element 122 as viewed from the light receiving surface side (+z side) of the imaging element 122. Fig. 3(b) is a cross-sectional view of the aa cross section of Fig. 3(a) as viewed from the -y side.
[0032] 3, in each pixel of the image sensor 122, a microlens 305 for collecting incident light is formed on the light-receiving side of the pixel, and a photoelectric conversion unit 301 and a photoelectric conversion unit 302 are formed, which are divided into N-H divisions (two divisions) in the x direction and N-V divisions (one division) in the y direction. The photoelectric conversion unit 301 and the photoelectric conversion unit 302 correspond to the first focus detection pixel 201 and the second focus detection pixel 202, respectively.
[0033] The photoelectric conversion units 301 and 302 may be pin structure photodiodes in which an intrinsic layer is sandwiched between a p-type layer and an n-type layer, or may be pn junction photodiodes in which the intrinsic layer is omitted. In each pixel, a color filter 306 is formed between the microlens 305 and the photoelectric conversion units 301 and 302. Furthermore, the spectral transmittance of the color filter may be changed for each subpixel, or the color filter may be omitted, as necessary.
[0034] Light incident on pixel 200G shown in Fig. 3 is collected by microlens 305, dispersed by color filter 306, and then received by photoelectric conversion unit 301 and photoelectric conversion unit 302. In photoelectric conversion unit 301 and photoelectric conversion unit 302, electron-hole pairs are generated according to the amount of received light, and after being separated by a depletion layer, negatively charged electrons are accumulated in the n-type layer, while holes are discharged to the outside of image sensor 122 through a p-type layer connected to a constant voltage source (not shown). The electrons accumulated in the n-type layers of photoelectric conversion unit 301 and photoelectric conversion unit 302 are transferred to a capacitance unit (FD) via a transfer gate and converted into a voltage signal.
[0035] Fig. 4 is a schematic diagram illustrating the correspondence between the pixel structure shown in Fig. 3 and pupil division. Fig. 4 shows a cross-sectional view of the aa cross section of the pixel structure shown in Fig. 3(a) viewed from the +y side, and the pupil plane (pupil distance Ds) of the image sensor 122. In Fig. 4, the x-axis and y-axis of the cross-sectional view are reversed compared to Fig. 3 in order to correspond to the coordinate axes of the pupil plane of the image sensor 122.
[0036] In FIG. 4, the first pupil partial region 501 is generally conjugate with the light receiving surface of the photoelectric conversion unit 301, whose center of gravity is decentered in the -x direction, via a microlens, and represents the pupil region that can receive light at the first focus detection pixel 201. The center of gravity of the first pupil partial region 501 is decentered on the +X side on the pupil plane. In FIG. 4, the second pupil partial region 502 is generally conjugate with the light receiving surface of the photoelectric conversion unit 302, whose center of gravity is decentered in the +x direction, via a microlens, and represents the pupil region that can receive light at the second focus detection pixel 202. The center of gravity of the second pupil partial region 502 is decentered on the -X side on the pupil plane. Also, in FIG. 4, the pupil region 500 is the pupil region that can receive light by the entire pixel 200G when the photoelectric conversion unit 301 and the photoelectric conversion unit 302 (the first focus detection pixel 201 and the second focus detection pixel 202) are all combined.
[0037] In image plane phase-difference AF, pupil division is performed using microlenses on the image sensor 122, which is therefore subject to the effects of diffraction. In Figure 4, the pupil distance to the pupil plane of the image sensor 122 is several tens of mm, while the diameter of the microlenses is several microns. This results in an aperture value of several tens of thousands, which causes diffraction blurring on the order of several tens of mm. As a result, the image on the light receiving surface of the photoelectric conversion unit does not show a clear pupil region or pupil subregion, but rather shows light receiving sensitivity characteristics (incident angle distribution of light receiving rate).
[0038] FIG. 5 is a schematic diagram showing the correspondence between the image sensor 122 and pupil division. Light beams that pass through different pupil partial regions, the first pupil partial region 501 and the second pupil partial region 502, are incident on each pixel of the image sensor 122 at different angles and are received by the first focus detection pixel 201 and the second focus detection pixel 202, which are divided into 2×1 regions. In the example of FIG. 5, the pupil region is divided into two in the horizontal direction. If necessary, the pupil may also be divided in the vertical direction. If necessary, the imaging pixel, first focus detection pixel, and second focus detection pixel may be configured as separate pixels, and the first focus detection pixel and the second focus detection pixel may be partially arranged in a portion of the imaging pixel array.
[0039] In the first embodiment, focus detection is performed by collecting light reception signals from the first focus detection pixels 201 of each pixel of the image sensor 122 to generate a first focus signal, and collecting light reception signals from the second focus detection pixels 202 of each pixel to generate a second focus signal. Furthermore, an image pickup signal (captured image) with a resolution of N effective pixels is generated by adding together the signals from the first focus detection pixels 201 and second focus detection pixels 202 for each pixel of the image sensor 122. The method of generating each signal is not particularly limited, and for example, the second focus detection signal may be generated from the difference between the image pickup signal and the first focus signal.
[0040] Relationship between defocus amount and image shift amount FIG. 6 shows a schematic diagram of the relationship between the defocus amount corresponding to the first and second focus detection signals acquired by the image sensor 122 and the image shift amount between the first and second focus detection signals. The image sensor 122 is disposed on an image sensor plane 600. As in FIGS. 4 and 5, the pupil plane of the image sensor 122 is divided into a first pupil partial region 501 and a second pupil partial region 502. The defocus amount d is defined as the distance from the subject's imaging position to the image sensor plane, denoted by |d|, with a negative sign (d<0) indicating a front-focus state in which the subject's imaging position is closer to the subject than the image sensor plane. A positive sign (d>0) indicates a back-focus state in which the subject's imaging position is on the opposite side of the image sensor plane. The in-focus state in which the subject's imaging position is on the image sensor plane (focus position) is d=0. In FIG. 6, the subject 601 shows an example of an in-focus state (d=0), and the subject 602 shows an example of a front-focus state (d<0). The front focus state (d<0) and the back focus state (d>0) are combined to form a defocus state (|d|>0).
[0041] In a front-focus state (d<0), a light beam from the subject 602 that passes through the first pupil partial region 501 (second pupil partial region 502) is first focused and then spreads to a width Γ1 (Γ2) around the center of gravity G1 (G2) of the light beam, forming a blurred image on the imaging surface 600. The blurred image is received by the first focus detection pixels 201 (second focus detection pixels 202) that constitute the pixels arranged on the image sensor 122, and a first focus detection signal (second focus detection signal) is generated. Therefore, the first focus detection signal (second focus detection signal) is recorded as a subject image in which the subject 602 is blurred to a width Γ1 (Γ2) at the center of gravity G1 (G2) on the imaging surface 600. The blur width Γ1 (Γ2) of the subject image increases roughly proportionally as the magnitude of the defocus amount d, |d|, increases. Similarly, the magnitude |p| of the image shift amount p (= the difference G1-G2 in the center of gravity positions of the light beams) of the subject image between the first focus detection signal and the second focus detection signal also increases roughly proportionally as the magnitude |d| of the defocus amount d increases. The same is true in the back-focus state (d>0), although the direction of the image shift of the subject image between the first focus detection signal and the second focus detection signal is opposite to that in the front-focus state.
[0042] As the magnitude of the defocus amount of the first focus detection signal and the second focus detection signal, or the imaging signal obtained by adding the first focus detection signal and the second focus detection signal, increases, the magnitude of the image shift amount between the first focus detection signal and the second focus detection signal also increases. Therefore, because the magnitude of the image shift amount between the first focus detection signal and the second focus detection signal increases as the magnitude of the defocus amount of the imaging signal increases, the phase difference AF section 129 converts the image shift amount into a detected defocus amount using a conversion coefficient calculated based on the base length.
[0043] Configuration of the subject detection unit 130 7 is a diagram showing details of subject detection unit 130. Subject detection unit 130 has an image data generation unit 710, a detection unit 711, a detection history storage unit 712, a dictionary data selection unit 713, and a dictionary data storage unit 714. Image data generation unit 710, detection unit 711, detection history storage unit 712, dictionary data selection unit 713, and dictionary data storage unit 714 may be part of camera MPU 125, or may be provided separately from camera MPU 125.
[0044] The image data output from the image processing circuit 124 is input to the image data generation unit 710. When dictionary data for entire area detection is selected by a dictionary data selection unit 713 (described later), the image data generation unit 710 generates image data for entire area detection using the input image data and sends it to the detection unit 711. On the other hand, when dictionary data for local area detection is selected by the dictionary data selection unit 713, the image data generation unit 710 generates image data for local area detection based on the detection history in a detection history storage unit 712 (described later), and sends it to the detection unit 711. Specific methods for generating the image data for entire area detection and the image data for local area detection will be described later.
[0045] The detection unit 711 acquires dictionary data selected by the dictionary data selection unit 713 from dictionary data generated by machine learning and stored in the dictionary data storage unit 714. Then, the detection unit 711 performs subject detection on the image data input from the image data generation unit 710 using the dictionary data acquired from the dictionary data storage unit 714. The detection unit 711 estimates the position of the subject included in the image data as the detection result, and stores the estimation result in the detection history storage unit 712.
[0046] In this embodiment, the detection unit 711 is configured with a machine-learned convolutional neural network (CNN) and performs overall region detection and local region detection of a specific object. The objects for which overall region detection and local region detection are possible are based on dictionary data stored in the dictionary data storage unit 714. In this embodiment, the detection unit 711 is configured with different CNNs for overall region detection and local region detection. Furthermore, the detection unit 711 may be configured with different CNNs depending on the objects that can be detected. The detection unit 711 may be realized by a graphics processing unit (GPU) or a circuit specialized for estimation processing by CNN.
[0047] The machine learning of the CNN can be performed by any method. For example, a predetermined computer such as a server may perform the machine learning of the CNN, and the camera body 120 may acquire the trained CNN from the predetermined computer. In this embodiment, the CNN of the detection unit 711 is trained by the predetermined computer using training image data as input and performing supervised learning using position information and the like of the subject corresponding to the training image data as training data (annotation). In this way, a trained CNN is generated. Note that the training of the CNN may also be performed by the camera body 120.
[0048] As described above, the detection unit 711 includes a CNN (trained model) trained by machine learning. The detection unit 711 receives image data as input, estimates the position, size, reliability, etc. of a subject, and outputs the estimated information. The CNN may be, for example, a network in which a fully connected layer and an output layer are connected to a layer structure in which convolutional layers and pooling layers are alternately stacked. In this case, for example, backpropagation may be applied to train the CNN. Furthermore, the CNN may be a neocognitron CNN that includes a feature detection layer (S layer) and a feature integration layer (C layer). In this case, a learning method called "Add-if Silent" may be applied to train the CNN.
[0049] The detection unit 711 may use any trained model other than a trained CNN. For example, a trained model generated by machine learning such as a support vector machine or a decision tree may be applied to the detection unit 711. Furthermore, the detection unit 711 does not need to use a trained model generated by machine learning. For example, the detection unit 711 may use any subject detection method that does not use machine learning.
[0050] The detection history storage unit 712 stores the subject detection history by the detection unit 711. The camera MPU 125 sends the history to the image data generation unit 710 and the dictionary data selection unit 713. The subject detection history includes, for example, the dictionary data used for detection, the number of detections, the position of the detected subject, and an identifier of the image data including the detected subject, but may be configured to include at least one of these pieces of data.
[0051] The dictionary data storage unit 714 stores dictionary data for detecting specific subjects. The camera MPU 125 reads the dictionary data selected by the dictionary data selection unit 713 from the dictionary data storage unit 714 and sends it to the detection unit 711. Each dictionary data is, for example, data in which characteristics of each body part of a specific subject are registered. Furthermore, to detect multiple types of subjects, dictionary data for each subject and each body part of the subject may be used. Therefore, multiple dictionary data are stored in the dictionary data storage unit 714. The dictionary data storage unit 714 stores multiple types of subject detection dictionary data, such as dictionary data for detecting "people," dictionary data for detecting "animals," and dictionary data for detecting "vehicles." Furthermore, the dictionary data storage unit 714 can further subdivide the dictionary data for detecting "vehicles" into categories such as "cars," "motorcycles," "trains," and "airplanes," and store them individually.
[0052] In this embodiment, dictionary data for detecting an entire region and dictionary data for detecting a local region are further prepared for each of the specific subjects. The entire region of a specific subject may be defined as an area literally including the entire subject, or as an area including a main part of the subject, such as the main body. For example, the entire region of a subject related to a "vehicle" can be defined for each type of subject, such as the "body" of a car or motorcycle, the "lead car" of a train, or the "fuselage" of an airplane. A local region is defined as a partial region of a subject identified in the entire region. For example, a local region may be defined as being included in the entire region, such as a "person's eyes" as a local region relative to a "person's entire face" as an entire region, or an "eyes" as a local region relative to a "person's entire face" as an entire region. Furthermore, a local region may not be included in the entire region, such as a "motorcycle's entire body" as an entire region and a "driver's helmet" that extends beyond the motorcycle's body as a local region.
[0053] Furthermore, the relationship may be one in which a local area does not necessarily exist for the entire area of the subject, such as "the entire body of a car" and "the driver's helmet" limited to a "formula car" among cars.
[0054] As described above, the dictionary data for detecting local regions is assumed to be a partial region of the subject detected in the entire region. Therefore, in this embodiment, the dictionary data used for detecting local regions is generated by learning using an image with the subject detected as the entire region as the background as an input image and using the position or size of the local region in the input image as an annotation.
[0055] The entire area of the subject detected using multiple dictionary data stored in the dictionary data storage unit 714 can be used as a focus detection area. For example, the results obtained from multiple focus detection areas arranged in the entire area can be used to output the defocus range of the subject.
[0056] However, for example, when the depth difference within the overall region is large, the problem of where to focus within the overall region arises. To address this problem, limiting the range using local region detection makes it possible to focus on more specific positions that cannot be determined solely from the overall region and depth information within that region, such as the "driver's seat" of a train or the "cockpit" of an airplane. Furthermore, in the case of a "vehicle" such as a motorcycle, the desired focal position may differ depending on whether a person is riding or not. By performing overall region detection and local region detection using dictionary data in which the overall region is the "entire motorcycle body" and the local region is the "driver's helmet," it becomes possible to switch the focal position for the same subject depending on whether the driver is present or not.
[0057] Furthermore, although the multiple dictionary data used by the detection unit 711 in this embodiment are generated by machine learning, dictionary data generated by a rule base may also be used. Rule-based dictionary data is, for example, stored with images of subjects to be detected or feature quantities specific to the subjects, as determined by a designer. By comparing the images or feature quantities of the dictionary data with the images or feature quantities of captured image data, the subject can be detected. Rule-based dictionary data is less complicated than trained models based on machine learning, and therefore requires less data volume. Furthermore, subject detection using rule-based dictionary data has a faster processing speed (and a smaller processing load) than subject detection using trained models.
[0058] The dictionary data selection unit 713 selects dictionary data to be used next based on the detection history stored in the detection history storage unit 712 and notifies the image data generation unit 710 and the dictionary data storage unit 714 of the selection.
[0059] In this embodiment, dictionary data for each of multiple types of subjects and each area of the subject is stored separately in the dictionary data storage unit 714, and subject detection is performed multiple times for the same image data by switching between multiple dictionary data. The dictionary data selection unit 713 determines a dictionary data switching sequence based on the detection history stored in the detection history storage unit 712 and a user selection (described later), and determines the dictionary data to use in accordance with the determined sequence.
[0060] The dictionary data storage unit 714 stores dictionary data for detecting multiple types of subjects and the regions of each subject individually. The dictionary data selected by the dictionary data selection unit 713 is switched depending on whether or not any subjects have been detected so far, the type of dictionary data used at that time, the type of subject to be preferentially detected, and a combination thereof. The type of subject to be preferentially detected may be selected in advance by the user. Alternatively, the method for determining the subject to be preferentially detected may involve the user specifying a subject within a live view screen displayed on the display unit 126. Furthermore, whether or not to perform local region detection may be selected for each type of dictionary data for whole region detection, or may be selected in advance by the user all at once. At this time, the camera MPU 125 may display information about the dictionary data selected by the user or the dictionary data selected by the dictionary data selection unit 713 on the display unit 126.
[0061] FIG. 8 is a diagram showing an example in which a user selects, from a menu screen displayed on the display unit 126, the type of subject to be preferentially detected and whether or not to perform local area detection. FIG. 8(a) shows a setting screen for selecting a detected subject displayed on the display unit 126. The user operates the operation switch group 127 to select a subject to be preferentially detected from specific detectable subjects (e.g., vehicles, animals, or people). FIG. 8(b) shows a setting screen for selecting whether or not to perform local area detection displayed on the display unit 126. The user operates the operation switch group 127 to select ON / OFF for local area detection (in FIG. 8(b) , local area detection ON is selected). FIG. 8(c) shows a live view screen displayed on the display unit 126 after the priority subject and local area detection settings have been made. The result of the selection of the priority subject is displayed on the display unit 126 as a subject icon 801. Furthermore, the result of the selection of whether or not to perform local area detection is displayed on the display unit 126 as a local area detection ON / OFF icon 802. This allows the user to confirm the settings they have made on the live view screen.
[0062] ●Shooting process flow Fig. 9 is a flowchart of the photographing process executed by the imaging device 10. Unless otherwise specified, the process of each step shown in Fig. 9 is realized by at least one of the camera MPU 125 and the lens MPU 117 executing a control program and controlling other components included in the imaging device 10 as necessary.
[0063] In S901, the camera MPU 125 controls the subject detection unit 130 to perform the above-described subject detection. The subject detection is performed, for example, on one of the live view images captured repeatedly. The following describes a case where multiple subjects corresponding to multiple body parts of a predetermined type of subject are detected. In the following, it is assumed that the predetermined type of subject is a person, and the multiple subjects corresponding to multiple body parts of the person are the eyes, face (head), and torso.
[0064] FIG. 10 shows a schematic diagram of the relationship between a subject and an area containing the subject (hereinafter referred to as a "subject area" or "subject detection area"). In FIG. 10, subject detection areas 1011 to 1013 have been detected. Subject detection unit 130 acquires the position and size of each of subject detection areas 1011 to 1013. Subject detection area 1011 corresponds to the pupil, subject detection area 1012 corresponds to the face (head), and subject detection area 1013 corresponds to the torso.
[0065] In S902, the camera MPU 125 selects a main subject from among the subjects detected in S901. The method for selecting the main subject is determined according to a priority order based on predetermined criteria. For example, the closer the position of the subject detection area is to the central image height, the higher the priority is set, and when the positions are the same (the distance from the central image height is the same), the larger the size, the higher the priority is set. Also, a configuration may be adopted in which a part of a particular type of subject (person) that the photographer often wants to focus on is selected. For example, in the case of a person, the area of the eye may be selected as the main subject.
[0066] In S903, the camera MPU 125 executes focus adjustment processing by controlling the phase difference AF unit 129 and the defocus range inference unit 132. Details of the focus adjustment processing will be described later with reference to FIG.
[0067] In S904, the camera MPU 125 performs an in-focus determination. If it is determined that the image is in focus, the process proceeds to S905. If it is determined that the image is not in focus, the process returns to S901, and the processes of S901 to S903 are performed on the next live view image.
[0068] In S905, the camera MPU 125 captures an image for recording.
[0069] Details of focus adjustment process (S903) 11 is a flowchart showing the details of the focus adjustment process (S903). In S1101, the phase difference AF section 129 acquires the subject detection result in S901 and the main subject selection result in S902.
[0070] In S1102, the phase difference AF unit 129 sets a focus detection area (defocus amount calculation area).
[0071] Figure 12 is a diagram showing an example of focus detection areas set in S1102. In Figure 12, 18 focus detection areas 1200 are set horizontally and 17 vertically over almost the entire shooting range. However, the method for setting the focus detection areas is not limited to this; focus detection areas may be set with an appropriately adjusted range and density so as to encompass the detected subject (subject detection areas 1011 to 1013).
[0072] In S1103, the phase difference AF unit 129 calculates the defocus amount for each focus detection area set in S1102. In the example of Fig. 12, the defocus amount is calculated for each of 18 focus detection areas in the horizontal direction and 17 focus detection areas in the vertical direction. The phase difference AF unit 129 generates a defocus map in which the calculated defocus amounts are arranged according to the position of the corresponding focus detection area.
[0073] The phase-difference AF unit 129 also calculates the reliability of the calculated defocus amount. Generally, the correlation calculation performed when calculating the defocus amount increases with the amount of signal included in the spatial frequency band being evaluated. For example, high-precision calculations are possible for signals with high contrast or high-frequency components. In this embodiment, reliability is calculated using a value correlated with the signal amount of the signal used in focus detection, and the greater the signal amount, the higher the reliability. Values used to calculate reliability may include the degree of change in the correlation amount at the position with the highest correlation in the correlation calculation or the absolute sum of the differences between adjacent signals used in focus detection. The greater the degree of change in the correlation amount or the greater the absolute sum, the higher the accuracy of the calculation, and therefore the higher the reliability is determined. In this embodiment, the reliability is determined to be high in three levels: low (0), medium (1), and high (2). One reliability value is calculated for each focus detection area, and the reliability is represented by a map of 18 horizontal and 17 vertical values. In this embodiment, a plurality of reliability values arranged in a map form is referred to as a reliability map.
[0074] In S1104, the defocus range inference unit 132 infers the defocus range of the subject. As inputs for inference, the defocus range inference unit 132 uses the defocus map and reliability map calculated in S1103, image data of the subject detection region, and the position and size of the subject detection region. The defocus range inference unit 132 outputs the defocus range of the subject as an inference result. When the person shown in FIG. 10 is the subject, image data of region 1014 which includes subject detection regions 1011 to 1013 is used as image data of the subject detection region. For the defocus map and reliability map as well, portions corresponding to region 1014 are used as inputs.
[0075] The defocus range of the subject is output for each subject detection region (for each of multiple layers). That is, two values, eye_max and eye_min, are output for subject detection region 1011 (eye). Two values, face_max and face_min, are output for subject detection region 1012 (head). Two values, body_max and body_min, are output for subject detection region 1013 (torso). Details of defocus range inference unit 132 will be described later.
[0076] In S1105, the camera MPU 125 extracts the focus detection area that belongs to the defocus range obtained in S1104. The method for extracting the focus detection area will be described with reference to FIGS.
[0077] FIG. 13 is a diagram showing a histogram of defocus amounts included in a defocus map (corresponding to area 1014 in FIG. 12) input when estimating the defocus range. In FIG. 13, the horizontal axis shows bins divided by defocus amount, with the right side corresponding to closer subjects. FIG. 13 shows that defocus amounts corresponding to people who are subjects are detected near a defocus amount of 0 (vertical axis). Also, the part with high frequency on the left side of FIG. 13 shows the frequency of defocus amounts for backgrounds that are farther away than the people. Meanwhile, the frequency of defocus amounts corresponding to subjects (trees shown in FIG. 12) that are closer to the people is shown on the right side of FIG. 13.
[0078] The defocus range for each subject detection region (each part of the person) obtained in S1104 is shown below the horizontal axis in FIG. 13. The defocus range for the torso is shown as the widest range, and the defocus range for the head and the defocus range for the pupil are shown as being contained within it. In FIG. 13, the defocus range output in S1104 is shown as a gradation for each bin of the histogram, but this embodiment is not limited to this, and the defocus range may be shown in finer gradations. In that case, it is also possible to determine for each focus detection region whether it is included in the defocus range for each part of the subject, and generate a histogram for each part of the subject.
[0079] FIG. 14 shows focus detection areas extracted based on the defocus range for each part of the subject within the input range (area 1014) of the defocus map. FIG. 14(a) shows a focus detection area 1401 extracted for the subject detection area 1013 (torso, first layer) based on the defocus range of the torso. The focus detection area 1401 roughly overlaps with the subject detection area 1013 (torso). Similarly, FIG. 14(b) shows a focus detection area 1402 extracted for the subject detection area 1012 (head, second layer) based on the defocus range of the head. The focus detection area 1402 roughly overlaps with the subject detection area 1012 (head). Similarly, FIG. 14(c) shows a focus detection area 1403 extracted for the subject detection area 1011 (pupil, third layer) based on the defocus range of the pupil. The focus detection area 1403 roughly overlaps with the subject detection area 1011 (pupil area).
[0080] The defocus range inference unit 132 of this embodiment uses machine learning, which will be described later, to infer the defocus range for each part of the subject. This makes it possible to exclude focus detection areas corresponding to focus detection results for the background or foreground of the subject, and to extract more accurate focus detection results (defocus amounts) for parts of the subject.
[0081] In S1106, the camera MPU 125 selects a focus detection area to be used for subsequent focus lens drive from among the focus detection areas extracted in S1105. The camera MPU 125 selects a focus detection area to be used from among the focus detection areas extracted in S1105, taking into consideration factors such as high reliability, high priority for focusing, and proximity to the focus detection result predicted from the focus detection result history. When the subject is a person, the priority for focusing may be determined in the order of pupil, head, and torso (first, second, and third layers). If there is no focus detection area with high reliability among the focus detection areas for the pupil extracted in S1105, the focus detection area with the next highest priority may be selected from the focus detection area for the head. Here, the defocus range inference unit 132 may estimate reliability based on the relationship between the defocus ranges of multiple parts. For example, if the defocus range of the pupil of the detected subject is outside the defocus range of the head or torso, it is likely to be an erroneous inference and its reliability is lowered (it is not adopted as the defocus range of the pupil or used as a part to be focused on). The number of focus detection areas selected is not particularly limited and may be one, or two or more. When multiple focus detection areas are selected, the defocus amount to be finally used may then be determined by performing processing such as averaging the defocus amounts or extracting the median.
[0082] In S1107, the phase difference AF unit 129 calculates the focus lens driving amount based on the defocus amount detected in the focus detection area selected in S1106.
[0083] In S1108, the phase difference AF unit 129 drives the focus lens 104 based on the focus lens driving amount calculated in S1107.
[0084] The focus adjustment process described above is configured to extract a focus detection area using the defocus range for each part of the subject obtained in S1104, and then select a focus detection area to be used for driving the focus lens. However, this embodiment is not limited to this configuration. For example, depending on the depth and size of the part of the subject, the defocus range obtained in S1104 may be sufficiently narrow. For example, if the subject is a person, the defocus range will be narrower for the pupil, which is smaller in area than the torso. In this way, if the defocus range for each part of the subject obtained in S1104 is sufficiently narrow, a specific value included in the defocus range (e.g., the center value of the defocus range) may be used as the defocus amount to calculate the drive amount of the focus lens.
[0085] Details of the defocus range inference unit 132 FIG. 15 is a diagram illustrating the details of the defocus range inference unit 132. The input unit 1501 integrates the image output by the image processing circuit 124, the defocus map and reliability map output by the phase difference AF unit 129, and the object map based on the object detection area output by the object detection unit 130 as data having multiple channels, and inputs the integrated data to the inference unit 1502. The input image may be an image of the entire range captured by the image sensor 122, or an image obtained by cropping the range including the object detection area. The object map is a map in which the object detection area is assigned a predetermined value (e.g., "1") and other areas are masked with other values (e.g., "0"). The reliability map is the same as that described with reference to S1103 in FIG. 11. A binary reliability map may be used in which only areas with "high" reliability are assigned a predetermined value (e.g., "1") and areas with "medium" or "low" reliability are masked with other values (e.g., "0"). The input image, defocus map, reliability map, and object map are appropriately upsampled or downsampled to match the input size (resolution).
[0086] The inference unit 1502 acquires parameters generated by machine learning and stored in the parameter storage unit 1504. Then, the inference unit 1502 uses the acquired parameters to infer a defocus range for the data input from the input unit 1501. The inference unit 1502 outputs, as an inference result, a defocus range corresponding to the body part of the subject included in the image. The output unit 1503 associates the defocus range of each body part (torso, head, and pupil) acquired from the inference unit 1502 with meta information such as the image ID, and outputs the result to the camera MPU 125. While the present embodiment describes a case in which the subject to be detected is a person, the inference unit 1502 may switch the information acquired from the parameter storage unit 1504 depending on the type of subject to be detected. In this case, although the cost of storing parameters increases, optimization according to the type of subject can be performed, thereby improving inference accuracy. Furthermore, a subject map may be generated for each body part of the subject, or only a subject map of a specific body part (e.g., the body) may be input as a representative of the body parts of the subject.
[0087] In this embodiment, the inference unit 1502 is configured with a machine-learned CNN and infers the defocus range for each part of the subject. The inference unit 1502 may be implemented by a graphics processing unit (GPU) or a circuit specialized for estimation processing using a CNN. The inference unit 1502 appropriately repeats convolution operations in a convolution layer and pooling in a pooling layer on the data input from the input unit 1501. The inference unit 1502 then performs global average pooling (GAP) to reduce the data. Next, the inference unit 1502 inputs the data that has undergone GAP processing into a multilayer perceptron (MLP). The inference unit 1502 is then configured to process any hidden layer, and then output the defocus range for each part via the output layer.
[0088] The inference unit 1502 may be a neural network using a CNN, a Vision Transformer (ViT), a Support Vector Machine (SVM) combined with a feature extractor, or any other suitable model. There are no particular limitations on the network format, but in the description of this embodiment, the inference unit 1502 will be described as a CNN.
[0089] In this embodiment, the inference unit 1502 is configured to infer a defocus range using an image, a defocus map, a reliability map, and an object map as input. The object map can be used to identify an object region (object detection region) that includes an object in the input image. Therefore, even in a scene where the defocus amount of the face changes continuously to the defocus amount of the arm, such as when the arm is in front of a person's face, the defocus range of the face region excluding the arm region can be extracted.
[0090] In the above description, the inference unit 1502 infers the defocus range corresponding to the subject, but the inference unit 1502 may be configured to infer the defocus amount corresponding to the subject. In this case, for example, the machine learning model of the inference unit 1502 may be trained so as to infer the defocus amount at a position (for example, the center of the defocus range) where the user is likely to want to focus, within the defocus range corresponding to the subject.
[0091] In this embodiment, the defocus amount included in the defocus map input to the inference unit 1502 is merely one example of distance information detected from the focus detection area. In this embodiment, the distance information is not limited to the defocus amount, and may be, for example, the image shift amount described with reference to FIG. 6. Similarly, the defocus range (or defocus amount) corresponding to the subject indicated by the inference result output by the inference unit 1502 is merely one example of the range of distance information (or distance information) corresponding to the subject. This also applies to the inference unit 1603 described below.
[0092] ●Configuration of learning device 1600 16 is a diagram showing the configuration of a learning device 1600. The learning device 1600 may be a device (for example, a personal computer) different from the imaging device 10, or the imaging device 10 may include the functions of the learning device 1600.
[0093] The learning device 1600 is configured to use learning data 1601 to train the inference unit 1603. The learning data acquisition unit 1602 acquires the learning data 1601, which includes a learning image, a defocus map, a reliability map, an object map, and a correct defocus range. The learning data acquisition unit 1602 passes the learning image, the defocus map, the reliability map, and the object map to the inference unit 1603, and passes the correct defocus range to the loss calculation unit 1604.
[0094] Of the training data 1601, the training image, defocus map, reliability map, and subject map are generated in advance by the imaging device 10 or another imaging device. The correct defocus range (correct information) of the training image is determined in advance so as to suppress the contribution of one or more defocus amounts not based on the subject among the multiple defocus amounts included in the defocus map. For example, the correct defocus range (correct information) is determined based on a defocus amount corresponding to an area where the subject actually exists among the multiple defocus amounts included in the defocus map. The area where the subject actually exists (first area) refers to an area of the subject detection area excluding the areas of the background and foreground obstacles (second area). The task of determining the correct defocus range is performed, for example, by a person visually checking the training image.
[0095] The inference unit 1603 has the same configuration as the inference unit 1502, and uses parameters acquired from the parameter storage unit 1605 to infer a defocus range (or defocus amount) corresponding to a subject included in a training image.
[0096] The loss calculation unit 1604 compares the inference result output from the inference unit 1603 with the correct defocus range passed from the training data acquisition unit 1602, and calculates a loss based on the difference. The weight update unit 1606 updates the weights (parameters) of the network used in machine learning so as to reduce the loss calculated by the loss calculation unit 1604. Thereafter, the weight update unit 1606 outputs the updated weights to the output unit 1607 and stores them in the parameter storage unit 1605. The weights stored in the parameter storage unit 1605 are used by the inference unit 1603 during the next training. By repeating training using multiple training images in sequence, the loss is reduced, and a machine learning model capable of inferring the defocus range (or defocus amount) with high accuracy is obtained. The defocus range inference unit 132 infers the defocus range (or defocus amount) using the model trained in this manner.
[0097] Example of Effects of the First Embodiment An example of the effect of the first embodiment will be described with reference to Fig. 17. Fig. 17 uses as an example an image captured at a different timing in the same scene as Fig. 14. A tree acts as an obstacle in the foreground and overlaps with a person. As shown in Fig. 17(a), a subject detection region 1702 corresponding to the head and a subject detection region 1703 corresponding to the torso are detected, but the pupil is not detected due to the influence of the right hand overlapping the pupil.
[0098] FIG. 17(b) shows a focus detection area 1404 extracted from the focus detection area corresponding to the subject detection area 1703 (torso) based on the defocus range obtained by the defocus range inference unit 132. The defocus amounts of the focus detection areas corresponding to the right arm area, tree area, and background area of the subject detection area 1703 (torso) are not included in the defocus range obtained by inference. Therefore, in FIG. 17(b), no focus detection areas are extracted from the right arm area, tree area, and background area of the subject detection area 1703 (torso). As described above with reference to FIG. 16, the defocus range inference unit 132 infers the defocus range using a machine learning model trained by the learning device 1600 to infer with high accuracy the defocus range of the area where the subject actually exists (area excluding the background area and obstacle areas in the foreground). Therefore, in S1105 of Fig. 11, the camera MPU 125 can extract a focus detection area with a highly accurate defocus amount as shown in Fig. 17(b), which in turn enables highly accurate focus control.
[0099] Similarly, FIG. 17(c) shows a focus detection area 1405 extracted from the focus detection area corresponding to the subject detection area 1702 (head) based on the defocus range obtained by the defocus range inference unit 132. The defocus amounts of the focus detection areas corresponding to the right arm area and background area of the subject detection area 1702 (head) are not included in the defocus range obtained by inference. Therefore, in FIG. 17(c), no focus detection areas are extracted from the right arm area and background area of the subject detection area 1702 (head). In this way, the same effect as that described with reference to FIG. 17(b) can be obtained for the subject detection area 1702 (head).
[0100] In the above description, the correct defocus range is determined so as not to include the defocus amount of the area where the subject actually exists (the area of the subject detection area excluding the background area and the foreground obstacle area). However, this embodiment can also be applied when an incorrect defocus amount for the subject (a defocus amount not based on the subject) is detected for reasons other than the background or obstacles. For example, when focus detection accuracy is poor and there is large variation in repeated focus detection, the focus detection results may vary even in an area where the subject actually exists. In such cases, a similar effect can be achieved by defining the correct defocus range so as not to include (suppress the contribution of) outliers in the defocus amount caused by variation (defocus amounts (distance information) with detection errors exceeding a predetermined level). This method can obtain a highly accurate defocus range even when the aperture value of the photographic optical system is large, which reduces focus detection accuracy, when the subject is located at a high image height, or when the subject has low contrast. Similarly, when a defocus amount affected by snow or rain is detected within the subject detection area, the correct defocus range can be defined by excluding that defocus amount. This makes it possible to estimate the defocus range of the subject with high accuracy regardless of the weather.
[0101] When performing focus detection and focus control, a known predictive AF process may be performed. This involves using a history of past focus detection results to predict the focus position at the time the imaging device captures an image and then performing focus control. When performing predictive AF process, the use of a highly accurate defocus range obtained by the defocus range inference unit 132 can prevent the use of an incorrect defocus amount. This prevents excessive focus control or delayed focus control in response to the actual movement of the subject, thereby enabling highly accurate focus control.
[0102] Variation 1 A first modified example of a method for utilizing the defocus range inferred by the defocus range inferring unit 132 will be described with reference to Figs. 18 and 19. Fig. 18 shows various scenes of a motorcycle when it is assumed that the subject is a vehicle (two-wheeled vehicle). Fig. 18(a) shows a scene photographed from the front, and Fig. 18(b) shows a scene photographed from the right front. In Fig. 18, a head 1801 and an entire vehicle body 1800 are shown as detection areas of subjects to be detected. As described above, subject detection can be achieved by using data for vehicles as dictionary data.
[0103] In such a shooting scene, if the photographer wants to obtain an image in which the subject's head is in focus, as described above, the photographer can select the defocus amount using the defocus range of the head and perform focus control to obtain an image in which the head is in focus with high accuracy.
[0104] On the other hand, there may be cases where it is desired to focus on the mark portion 1802 in front of the motorcycle. FIG. 19 shows the defocus range output by the defocus range inference unit 132, which changes over time in a shooting scene such as the example shown in FIG. 18. FIG. 19 graphs the maximum value (body_max) of the defocus range and the minimum value (body_min) of the defocus range for the subject detection result of the entire vehicle body. In this embodiment, regarding the positive and negative defocus amounts, a positive value indicates a defocus state on the far side of the in-focus area, and a negative value indicates a defocus state on the closest side. The horizontal axis represents time, and the vertical axis represents the defocus amount. In situations such as those shown in FIGS. 18 and 19, it is possible to derive an appropriate defocus amount from the inferred defocus range in order to focus on the mark portion 1802 on the vehicle body. For example, if the location on which you always want to focus is closest to the photographer, focus control can be performed using the defocus amount on the closest side indicated by the defocus range. When photographing a motorcycle as shown in Figure 18, the front wheel is the closest part, so one possible method is to perform focus control using a defocus amount that is 20% of the closest side of the defocus range. This defocus amount can be calculated using the following formula: 0.8 × body_min + 0.2 × body_max.
[0105] It is also conceivable to allow the photographer to input the desired focus position within the defocus range, which would enable the photographer to set the depth of field according to the shooting distance of the subject, etc.
[0106] Variation 2 As a second variation of the method of utilizing the defocus range inferred by the defocus range inferring unit 132, a variation in which the aperture is controlled (adjusted) will be described. Taking advantage of the ability to infer the defocus range for each part of the subject, it is conceivable to control the aperture of the AE unit 131. Aperture control not only adjusts the amount of light but also the depth of field. Using information on the defocus range of the subject, it is possible to adjust the aperture to determine to what extent the subject included in the desired subject detection area is included in the depth of field. For example, by adjusting the aperture so that the defocus range of the subject falls within a unit depth determined by the permissible circle of confusion, it is possible to achieve a state in which the entire subject within the subject detection area is in focus.
[0107] Furthermore, in this embodiment, by utilizing the fact that the defocus range is output for each part of the subject, aperture control that is more in line with the photographer's intentions can be performed. For example, in the example of Fig. 18, aperture control is possible such that the range closest to the head and body is in focus. This can be achieved by controlling the aperture so that the defocus range from the head's defocus range "head_max" to the defocus range "body_min" of the entire body is included in the depth of field.
[0108] Variation 3 As a third variation of the method of utilizing the defocus range inferred by the defocus range inferring unit 132, a variation of displaying the defocus range of the subject will be described. In Fig. 14, the focus detection areas included in the defocus range corresponding to the detection area for each part of the subject are shown as frames (information notifying the focus detection area) of focus detection area 1401 and focus detection area 1402. This represents the focus detection area extracted using the output of the defocus range inferring unit 132, but the extracted focus detection area 1401 and focus detection area 1402 may also be displayed on the display unit 126 to inform the photographer.
[0109] By utilizing the inference results of the defocus range inference unit 132, the defocus range can be displayed along with the area of the detected subject when displaying a live view during shooting or a captured image. When displaying the defocus amount, the defocus amount may be converted onto a color scale, and the magnitude of the defocus amount may be displayed using different colors. This allows the photographer to visually confirm the focus state of the subject detection area as intended. In addition, it is possible to visually confirm that the focus detection result is not affected by the background or foreground, allowing shooting in a focus state that matches the photographer's intention.
[0110] Summary of the first embodiment As described above, according to the first embodiment, the imaging device 10 performs inference using a machine learning model based on a subject region including a subject (e.g., a person's head) in an image obtained by shooting and multiple pieces of distance information (e.g., a defocus map) detected from multiple focus detection regions within the subject region, thereby generating an inference result indicating distance information corresponding to the subject (e.g., a defocus amount) or a range of distance information corresponding to the subject (e.g., a range of defocus amounts). The machine learning model is a model trained to suppress the contribution of one or more pieces of distance information that are not based on the subject to the inference result. The one or more pieces of distance information that are not based on the subject include, for example, one or more pieces of distance information corresponding to one or more focus detection regions that correspond to an area of the subject region where no subject is present, or one or more pieces of distance information with a detection error exceeding a predetermined degree.
[0111] Furthermore, according to the first embodiment, the learning device 1600 performs inference using a machine learning model based on a subject area including a subject in an image obtained by shooting and multiple pieces of distance information detected from multiple focus detection areas within the subject area, thereby generating an inference result indicating distance information corresponding to the subject or a range of distance information corresponding to the subject. The learning device 1600 then trains the machine learning model so that the inference result approaches ground truth information in which the contribution of one or more pieces of distance information that are not based on the subject among the multiple pieces of distance information is suppressed.
[0112] Therefore, according to the first embodiment, when using multiple pieces of distance information detected from multiple focus detection areas within a subject area, it is possible to suppress the contribution of distance information that is not based on the subject.
[0113] [Other embodiments] The present invention can also be realized by supplying a program that realizes one or more functions of the above-described embodiments to a system or device via a network or a storage medium, and having one or more processors in the computer of the system or device read and execute the program.The present invention can also be realized by a circuit (e.g., ASIC) that realizes one or more functions.
[0114] [summary] The above-described embodiment discloses at least the inventions shown in the following items, but is not limited to these inventions. [Item 1] an inference unit that performs inference using a machine learning model based on a subject area including a subject in an image obtained by photographing and multiple pieces of distance information detected from multiple focus detection areas within the subject area, thereby generating an inference result that indicates distance information corresponding to the subject or a range of distance information corresponding to the subject; The machine learning model is a model trained to suppress the contribution of one or more pieces of distance information that are not based on the subject, among the plurality of pieces of distance information, to the inference result. An inference device characterized by: [Item 2] the subject area includes a first area in which the subject is present and a second area in which the subject is not present, The one or more pieces of distance information that are not based on the subject among the plurality of pieces of distance information include one or more pieces of distance information corresponding to one or more focus detection areas that correspond to the second area among the plurality of focus detection areas. 2. The inference device according to item 1, [Item 3] The one or more pieces of distance information that are not based on the subject among the plurality of pieces of distance information include one or more pieces of distance information that involve a detection error exceeding a predetermined degree among the plurality of pieces of distance information. 3. The inference device according to item 1 or 2, [Item 4] The imaging device further includes a first adjusting means for adjusting the focus of an optical system used for the imaging based on the result of the inference. 4. The inference device according to any one of items 1 to 3, [Item 5] the inference result indicates a range of the distance information corresponding to the subject; The first adjustment means adjusts the focus of the optical system based on distance information included in the range of the distance information among the plurality of distance information. 5. The inference device according to item 4, [Item 6] the inference result indicates a range of the distance information corresponding to the subject; The inference device further includes a second adjustment means for adjusting an aperture of an optical system used for the photographing based on the range of the distance information. 6. An inference device according to any one of items 1 to 5, characterized in that: [Item 7] The second adjusting means adjusts the aperture of the optical system based on the range of the distance information so that the subject is included in the depth of field. 7. The inference device according to item 6, [Item 8] the inference result indicates a range of the distance information corresponding to the subject; The inference device further includes a display unit that displays information notifying a focus detection area corresponding to distance information included in the range of the distance information among the plurality of distance information. 8. An inference device according to any one of items 1 to 7, characterized in that: [Item 9] The plurality of pieces of distance information detected from the plurality of focus detection areas are a plurality of defocus amounts detected from the plurality of focus detection areas. 9. The inference device according to any one of items 1 to 8, [Item 10] The inference result indicates a defocus amount corresponding to the subject or a range of defocus amounts corresponding to the subject. 10. The inference device according to item 9, [Item 11] An inference device according to any one of items 1 to 10; an imaging means for generating the image by the imaging; a first detection means for detecting the subject area from the image; a second detection means for detecting the plurality of pieces of distance information from the plurality of focus detection areas within the subject area; An imaging device comprising: [Item 12] the first detection means detects a plurality of subject regions each of which partially includes any one of a plurality of subjects; the second detection means detects a plurality of pieces of distance information for each of the plurality of subject regions; The inference means generates an inference result for each of the plurality of subjects. Item 12. The imaging device according to item 11. [Item 13] The plurality of subjects correspond to a plurality of parts of a predetermined type of subject. Item 13. The imaging device according to item 12. [Item 14] an acquisition means for acquiring an image obtained by photographing, information on a subject area in the image including a subject, and a plurality of pieces of distance information corresponding to a plurality of areas in the subject area; an inference means for performing inference using a machine learning model with the image, information about the subject area, and the plurality of pieces of distance information as input, to generate an inference result indicating distance information corresponding to the subject or a range of distance information corresponding to the subject; An inference device comprising: [Item 15] the acquisition means acquires a plurality of pieces of distance information corresponding to a plurality of parts of the subject, The inference means generates an inference result indicating a range of a plurality of pieces of distance information corresponding to the plurality of parts. 15. The inference device according to item 14, [Item 16] Item 15: An inference device according to item 15; an imaging means for generating the image by the imaging; a determination means for determining a region to be focused on based on the priority of the plurality of regions from the ranges of the plurality of pieces of distance information corresponding to the plurality of regions output from the inference device; An imaging device comprising: [Item 17] The determining means determines a region to be focused on within the ranges of the distance information by comparing the ranges of the distance information corresponding to the plurality of regions with each other. Item 17. The imaging device according to item 16. [Item 18] an inference means for performing inference using a machine learning model based on a subject area including a subject in an image obtained by photographing and multiple pieces of distance information detected from multiple focus detection areas within the subject area, thereby generating an inference result indicating distance information corresponding to the subject or a range of distance information corresponding to the subject; a learning means for learning the machine learning model so that the inference result approaches correct answer information in which the contribution of one or more pieces of distance information that are not based on the subject among the plurality of pieces of distance information is suppressed; and A learning device comprising: [Item 19] An inference method executed by an inference device, comprising: an inference step of performing inference using a machine learning model based on a subject area including a subject in an image obtained by photographing and multiple pieces of distance information detected from multiple focus detection areas within the subject area, thereby generating an inference result indicating distance information corresponding to the subject or a range of distance information corresponding to the subject; The machine learning model is a model trained to suppress the contribution of one or more pieces of distance information that are not based on the subject, among the plurality of pieces of distance information, to the inference result. An inference method characterized by: [Item 20] A learning method executed by a learning device, an inference process for generating an inference result indicating distance information corresponding to the subject or a range of distance information corresponding to the subject by performing inference using a machine learning model based on a subject area including the subject in the image obtained by photographing and multiple pieces of distance information detected from multiple focus detection areas within the subject area; a learning process of learning the machine learning model so that the inference result approaches correct answer information in which the contribution of one or more pieces of distance information that are not based on the subject among the plurality of pieces of distance information is suppressed; A learning method comprising: [Item 21] A program for causing a computer to function as each means of the inference device described in any one of items 1 to 10, 14, and 15. [Item 22] A program for causing a computer to function as each means of the learning device described in item 18.
[0115] The invention is not limited to the above-described embodiments, and various changes and modifications can be made without departing from the spirit and scope of the invention. Accordingly, the following claims are appended to apprise the public of the scope of the invention. [Explanation of symbols]
[0116] 132...defocus range inference unit, 1501...input unit, 1502...inference unit, 1504...parameter storage unit, 1600...learning device, 1602...learning data acquisition unit, 1603...inference unit, 1604...loss calculation unit, 1605...parameter storage unit, 1606...weight update unit
Claims
1. an inference means for performing inference using a machine learning model based on a subject area including a subject in an image obtained by shooting and a plurality of pieces of distance information detected from a plurality of focus detection areas in the subject area, thereby generating an inference result indicating distance information corresponding to the subject or a range of distance information corresponding to the subject; The machine learning model is a model trained to suppress the contribution of one or more pieces of distance information that are not based on the subject, among the plurality of pieces of distance information, to the inference result. An inference device comprising:
2. the subject area includes a first area in which the subject is present and a second area in which the subject is not present, The one or more pieces of distance information that are not based on the subject among the plurality of pieces of distance information include one or more pieces of distance information corresponding to one or more focus detection areas that correspond to the second area among the plurality of focus detection areas.
2. The inference device according to claim 1 .
3. The one or more pieces of distance information that are not based on the subject among the plurality of pieces of distance information include one or more pieces of distance information that include a detection error exceeding a predetermined degree among the plurality of pieces of distance information.
2. The inference device according to claim 1 .
4. a first adjustment unit that adjusts the focus of an optical system used for the photographing based on the result of the inference; 2. The inference device according to claim 1 .
5. the inference result indicates a range of the distance information corresponding to the subject, The first adjustment means adjusts the focus of the optical system based on distance information included in a range of the distance information among the plurality of distance information.
5. The inference device according to claim 4.
6. the inference result indicates a range of the distance information corresponding to the subject, The inference device further includes a second adjustment means for adjusting an aperture of an optical system used for the photographing based on the range of the distance information.
2. The inference device according to claim 1 .
7. The second adjustment means adjusts the aperture of the optical system based on the range of the distance information so that the subject is included in a depth of field.
7. The inference device according to claim 6.
8. the inference result indicates a range of the distance information corresponding to the subject, The inference apparatus further includes a display unit that displays information notifying a focus detection area corresponding to distance information included in a range of the distance information among the plurality of distance information.
2. The inference device according to claim 1 .
9. The plurality of pieces of distance information detected from the plurality of focus detection areas are a plurality of defocus amounts detected from the plurality of focus detection areas.
2. The inference device according to claim 1 .
10. The inference result indicates a defocus amount corresponding to the object or a range of defocus amounts corresponding to the object.
10. The inference device according to claim 9.
11. The inference device according to claim 1 ; an imaging means for generating the image by photographing; a first detection means for detecting the subject region from the image; a second detection means for detecting the plurality of pieces of distance information from the plurality of focus detection areas within the subject area; An imaging device comprising:
12. the first detection means detects a plurality of subject regions each of which partially includes any one of a plurality of subjects; the second detection means detects a plurality of pieces of distance information for each of the plurality of subject regions; The inference means generates an inference result for each of the plurality of subjects.
12. The imaging device according to claim 11.
13. The plurality of subjects corresponds to a plurality of parts of a predetermined type of subject.
13. The imaging device according to claim 12.
14. an acquisition means for acquiring an image obtained by photographing, information on a subject area including a subject in the image, and a plurality of pieces of distance information corresponding to a plurality of areas in the subject area; an inference means for performing inference using a machine learning model with the image, the information on the object region, and the plurality of pieces of distance information as input, thereby generating an inference result indicating distance information corresponding to the object or a range of distance information corresponding to the object; An inference device comprising:
15. the acquiring means acquires a plurality of pieces of distance information corresponding to a plurality of parts of the subject, The inference means generates an inference result indicating a range of a plurality of pieces of distance information corresponding to the plurality of parts.
15. The inference device according to claim 14.
16. An inference device according to claim 15; an imaging means for generating the image by photographing; a determining means for determining a region to be focused on based on the priority of the plurality of regions from the ranges of the plurality of pieces of distance information corresponding to the plurality of regions output from the inference device; An imaging device comprising:
17. The determining means determines a region to be focused on within the ranges of the distance information by comparing the ranges of the distance information corresponding to the plurality of regions with each other.
17. The imaging device according to claim 16.
18. an inference means for performing inference using a machine learning model based on a subject area including a subject in an image obtained by shooting and multiple pieces of distance information detected from multiple focus detection areas within the subject area, thereby generating an inference result indicating distance information corresponding to the subject or a range of distance information corresponding to the subject; A learning means for learning the machine learning model so that the inference result approaches correct answer information in which the contribution of one or more pieces of distance information that are not based on the subject among the plurality of pieces of distance information is suppressed; A learning device comprising:
19. An inference method executed by an inference device, comprising: an inference step of performing inference using a machine learning model based on a subject area including a subject in an image obtained by shooting and a plurality of pieces of distance information detected from a plurality of focus detection areas in the subject area, thereby generating an inference result indicating distance information corresponding to the subject or a range of distance information corresponding to the subject; The machine learning model is a model trained to suppress the contribution of one or more pieces of distance information that are not based on the subject, among the plurality of pieces of distance information, to the inference result.
13. An inference method comprising:
20. A learning method executed by a learning device, comprising: an inference process for generating an inference result indicating distance information corresponding to the subject or a range of distance information corresponding to the subject by performing inference using a machine learning model based on a subject area including the subject in an image obtained by shooting and multiple pieces of distance information detected from multiple focus detection areas within the subject area; A learning process of learning the machine learning model so that the inference result approaches correct answer information in which the contribution of one or more pieces of distance information that are not based on the subject among the plurality of pieces of distance information is suppressed; A learning method comprising:
21. A program for causing a computer to function as each of the means of the inference device according to any one of claims 1 to 10, 14 and 15.
22. A program for causing a computer to function as each of the means of the learning device according to claim 18.
Citation Information
Patent Citations
Focus adjustment device and focus adjustment method
JP2022137760A
Cited By
Imaging system, method for operating imaging system, and program
WO2026070125A1
