OBJECT DETECTION METHOD AND COMPUTER DEVICE

20170228890 · 2017-08-10

    Inventors

    Cpc classification

    International classification

    Abstract

    Embodiments of the present invention disclose an object detection method and a computer device. The method includes: obtaining a to-be-processed image; obtaining, according to the to-be-processed image, n reference regions used to identify a to-be-detected object in the to-be-processed image, and n detection accuracy values, of the to-be-detected object, corresponding to the n reference regions; determining sample reference regions in the n reference regions, where coincidence degrees of the sample reference regions is greater than a preset threshold; and determining, based on the sample reference regions, a target region corresponding to the to-be-detected object, where the target region is used to identify the to-be-detected object in the to-be-processed image. Implementation of the embodiments of the present invention helps improve accuracy of detecting a location of an object.

    Claims

    1. An object detection method, comprising: obtaining a to-be-processed image; obtaining, according to the to-be-processed image, n reference regions used to identify a to-be-detected object in the to-be-processed image, and n detection accuracy values, of the to-be-detected object, corresponding to the n reference regions, wherein n is an integer greater than 1; determining sample reference regions in the n reference regions, wherein coincidence degrees between the sample reference regions and a reference region that corresponds to a maximum value in the n detection accuracy values is greater than a preset threshold; and determining, based on the sample reference regions, a target region corresponding to the to-be-detected object, wherein the target region is used to identify the to-be-detected object in the to-be-processed image.

    2. The method according to claim 1, wherein the determining, based on the sample reference regions, a target region corresponding to the to-be-detected object comprises: normalizing coordinate values of the sample reference regions, to obtain normalized coordinate values of the sample reference regions, wherein the coordinate value of the sample reference regions is used to represent the sample reference regions; determining, based on the normalized coordinate values of the sample reference regions, characteristic values of the sample reference regions; and determining, based on the characteristic values, a coordinate value used to identify the target region corresponding to the to-be-detected object in the to-be-processed image.

    3. The method according to claim 2, wherein the normalizing coordinate values of the sample reference regions, to obtain normalized coordinate values of the sample reference regions comprises: calculating, based on the following formula, the normalized coordinate values of the sample reference regions: x ^ 1 i = x 1 i - 1 2 .Math. Π .Math. .Math. j = 1 p .Math. I ( s j ) .Math. ( x 1 j + x 2 j ) 1 Π .Math. .Math. j = 1 p .Math. I ( s j ) .Math. ( x 2 j - x 1 j ) , wherein a quantity of the sample reference regions is p, p is a positive integer less than or equal to n, and x.sub.1.sup.i is a horizontal coordinate, in the to-be-processed image, of a pixel that is located in an upper-left corner of the i.sup.th reference region in the sample reference regions; x.sub.1.sup.j is a horizontal coordinate, in the to-be-processed image, of a pixel that is located in an upper-left corner of the j.sup.th reference region in the sample reference regions, x.sub.2.sup.j is a horizontal coordinate, in the to-be-processed image, of a pixel that is located in a lower-right corner of the j.sup.th reference region, and {circumflex over (x)}.sub.1.sup.i is a normalized horizontal ordinate of the pixel that is located in the upper-left corner of the i.sup.th reference region; or x.sub.1.sup.j is a horizontal coordinate, in the to-be-processed image, of a pixel that is located in a lower-left corner of the j.sup.th reference region, x.sub.2.sup.j is a horizontal coordinate, in the to-be-processed image, of a pixel that is located in an upper-right corner of the j.sup.th reference region, and {circumflex over (x)}.sub.1.sup.i is a normalized horizontal ordinate of a pixel that is located in a lower-left corner of the i.sup.th reference region; and I(s.sub.j) is an indicator function, where when a detection accuracy value s.sub.j corresponding to the j.sup.th reference region is greater than a preset accuracy value, I(s.sub.j) is 1, when a detection accuracy value s.sub.j corresponding to the j.sup.th reference region is less than or equal to the preset accuracy value, I(s.sub.j) is 0, Π=Σ.sub.j=1.sup.pI(s.sub.j), and both i and j are positive integers less than or equal to p.

    4. The method according to claim 2, wherein the characteristic values comprise a first characteristic value, and the determining, based on the normalized coordinate values of the sample reference regions, characteristic values of the sample reference regions comprises: calculating, based on the following formula, the first characteristic value: u l = 1 .Math. t .Math. .Math. .Math. i = 1 P .Math. .Math. g t ( s i ) .Math. b ^ i , wherein the quantity of the sample reference regions is p, p is a positive integer less than or equal to n, the first characteristic value u({circumflex over (B)}) includes u.sub.t, Π.sub.t=Σ.sub.i=1.sup.pg.sub.t(s.sub.i), s.sub.i is a detection accuracy value corresponding to the i.sup.th reference region in the sample reference regions, a function g.sub.t(s.sub.i) is a function of s.sub.i, the function g.sub.t(s.sub.i) is used as a weighting function of {circumflex over (b)}.sub.i, {circumflex over (b)}.sub.i is the normalized coordinate values of the sample reference regions, i is a positive integer less than or equal to p, {circumflex over (b)}.sub.i={{circumflex over (x)}.sub.1.sup.i,ŷ.sub.1.sup.i,{circumflex over (x)}.sub.2.sup.i,ŷ.sub.2.sup.i}, and {circumflex over (B)} represents the sample reference regions; and {circumflex over (x)}.sub.1.sup.i is the normalized horizontal coordinate, in the to-be-processed image, of the pixel that is located in the upper-left corner of the i.sup.th reference region in the sample reference regions, ŷ.sub.1.sup.i is a normalized vertical coordinate, in the to-be-processed image, of the pixel that is located in the upper-left corner of the i.sup.th reference region, {circumflex over (x)}.sub.2.sup.i is a normalized horizontal coordinate, in the to-be-processed image, of a pixel that is located in a lower-right corner of the i.sup.th reference region, and ŷ.sub.2.sup.i is a normalized vertical coordinate, in the to-be-processed image, of the pixel that is located in the lower-right corner of the i.sup.th reference region.

    5. The method according to claim 4, wherein the first characteristic value u({circumflex over (B)})=[u.sub.1, . . . u.sub.d].sup.T, d is a positive integer, t is a positive integer less than or equal to d, u.sub.t is the t.sup.th characteristic value of the first characteristic value, the function g.sub.t(s.sub.i) is the t.sup.th weighting function of weighting functions of {circumflex over (b)}.sub.i, and the weighting functions of {circumflex over (b)}.sub.i comprise at least one of the following: g ( s i ) = exp ( ρ 1 .Math. s i ) , g ( s i ) = exp ( ρ 2 .Math. s i ) , g ( s i ) = exp ( ρ 3 .Math. s i ) , g ( s i ) = ( s i - τ 1 ) 1 2 , g ( s i ) = ( s i - τ 2 ) 1 2 , g ( s i ) = ( s i - τ 3 ) 1 2 , g ( s i ) = s i - τ 1 , g ( s i ) = s i - τ 2 , g ( s i ) = s i - τ 3 , g ( s i ) = min ( s i - τ 1 , 4 ) , g ( s i ) = min ( s i - τ 2 , 4 ) , g ( s i ) = min ( s i - τ 3 , 4 ) , g ( s i ) = 1 1 + exp ( - ρ 1 .Math. s i ) , g ( s i ) = 1 1 + exp ( - ρ 2 .Math. s i ) , g ( s i ) = 1 1 + exp ( - ρ 3 .Math. s i ) g ( s i ) = ( s i - τ 1 ) 2 , g ( s i ) = ( s i - τ 2 ) 2 , g ( s i ) = ( s i - τ 3 ) 2 , , wherein the ρ1, τ1, ρ2, τ2, ρ3, and τ3 are normalization coefficients.

    6. The method according to claim 2, wherein the characteristic values further comprise a second characteristic value, and the determining, based on the normalized coordinate values of the sample reference regions, characteristic values of the sample reference regions comprises: calculating, based on the following formula, the second characteristic value: M ( B ^ ) = 1 p .Math. D T .Math. D , wherein M({circumflex over (B)}) is the second characteristic value, the quantity of the sample reference regions is p, p is a positive integer less than or equal to n, a matrix D comprises the normalized coordinate values of the sample reference regions, the i.sup.th row in the matrix D comprises normalized coordinate value of the i.sup.th reference region in the sample reference regions, and {circumflex over (B)} represents the sample reference regions.

    7. The method according to claim 6, wherein the determining, based on the characteristic values, a coordinate value of the target region corresponding to the to-be-detected object comprises: calculating, according to the following formula, the coordinate value of the target region: h 1 ( B ^ ) = λ + Λ 1 T .Math. u ( B ^ ) + Λ 2 T .Math. m ( B ^ ) = Λ T .Math. R ( B ^ ) , wherein h.sup.1({circumflex over (B)}) is the coordinate value of the target region corresponding to the to-be-detected object, u({circumflex over (B)}) is the first characteristic value, m({circumflex over (B)}).sup.T is a vector form of the second characteristic value M({circumflex over (B)}), λ, Λ.sub.1, and Λ.sub.2 are coefficients, Λ=[λ,Λ.sub.1.sup.T,Λ.sub.2.sup.T].sup.T, R({circumflex over (B)})=[1, u({circumflex over (B)}).sup.T, m({circumflex over (B)}).sup.T].sup.T, and {circumflex over (B)} represents the sample reference regions.

    8. The method according to claim 7, wherein a value of the coefficient Λ is determined by using the following model: min Λ .Math. 1 2 .Math. Λ T .Math. Λ + C .Math. .Math. k = 1 K .Math. .Math. [ max ( 0 , .Math. Z ^ 1 k - h 1 ( B ^ k ) .Math. - ) ] 2 , wherein C and ε are preset values, K is a quantity of pre-stored training sets, {circumflex over (Z)}.sub.1.sup.k is a preset coordinate value of a target region corresponding to a reference region in the k.sup.th training set of the K training sets, and {circumflex over (B)}.sub.k represents the reference region in the k.sup.th training set.

    9. A computer device, comprising: a memory that stores executable program code; and a processor that is coupled with the memory, wherein the processor invokes the executable program code stored in the memory and performs the following steps: obtaining a to-be-processed image; obtaining, according to the to-be-processed image, n reference regions used to identify a to-be-detected object in the to-be-processed image, and n detection accuracy values, of the to-be-detected object, corresponding to the n reference regions, wherein n is an integer greater than 1; determining sample reference regions in the n reference regions, wherein coincidence degrees between the sample reference regions and a reference region that corresponds to a maximum value in the n detection accuracy values is greater than a preset threshold; and determining, based on the sample reference regions, a target region corresponding to the to-be-detected object, wherein the target region is used to identify the to-be-detected object in the to-be-processed image.

    10. The computer device according to claim 9, wherein a specific implementation manner of the determining, by the processor and based on the sample reference regions, a target region corresponding to the to-be-detected object is: normalizing coordinate values of the sample reference regions, to obtain normalized coordinate values of the sample reference regions, wherein the coordinate value of the sample reference regions is used to represent the sample reference regions; determining, based on the normalized coordinate values of the sample reference regions, characteristic values of the sample reference regions; and determining, based on the characteristic values, a coordinate value used to identify the target region corresponding to the to-be-detected object in the to-be-processed image.

    11. The computer device according to claim 10, wherein a specific implementation manner of the normalizing, by the processor, a coordinate value of the sample reference regions, to obtain normalized coordinate values of the sample reference regions is: calculating, based on the following formula, the normalized coordinate values of the sample reference regions: x ^ 1 i = x 1 i - 1 2 .Math. Π .Math. .Math. j = 1 p .Math. .Math. I ( s j ) .Math. ( x 1 j + x 2 j ) 1 Π .Math. .Math. j = 1 p .Math. .Math. I ( s j ) .Math. ( x 2 j - x 1 j ) , wherein a quantity of the sample reference regions is p, p is a positive integer less than or equal to n, and x.sub.1.sup.i is a horizontal coordinate, in the to-be-processed image, of a pixel that is located in an upper-left corner of the i.sup.th reference region in the sample reference regions; x.sub.1.sup.j is a horizontal coordinate, in the to-be-processed image, of a pixel that is located in an upper-left corner of the j.sup.th reference region in the sample reference regions, x.sub.2.sup.j is a horizontal coordinate, in the to-be-processed image, of a pixel that is located in a lower-right corner of the j.sup.th reference region, and {circumflex over (x)}.sub.1.sup.i is a normalized horizontal ordinate of the pixel that is located in the upper-left corner of the i.sup.th reference region; or x.sub.1.sup.j is a horizontal coordinate, in the to-be-processed image, of a pixel that is located in a lower-left corner of the j.sup.th reference region, x.sub.2.sup.j is a horizontal coordinate, in the to-be-processed image, of a pixel that is located in an upper-right corner of the j.sup.th reference region, and {circumflex over (x)}.sub.1.sup.i is a normalized horizontal ordinate of a pixel that is located in a lower-left corner of the i.sup.th reference region; and I(s.sub.j) is an indicator function, where when a detection accuracy value s.sub.j corresponding to the j.sup.th reference region is greater than a preset accuracy value, I(s.sub.j) is 1, when a detection accuracy value s.sub.j corresponding to the j.sup.th reference region is less than or equal to the preset accuracy value, I(s.sub.j) is 0, Π=Σ.sub.j=1.sup.pI(s.sub.j), and both i and j are positive integers less than or equal to p.

    12. The computer device according to claim 10, wherein the characteristic values comprise a first characteristic value, and a specific implementation manner of the determining, by the processor and based on the normalized coordinate values of the sample reference regions, characteristic values of the sample reference regions is: calculating, based on the following formula, the first characteristic value: u i = 1 .Math. i .Math. .Math. .Math. i = 1 p .Math. .Math. g t ( s i ) .Math. b ^ i , wherein the quantity of the sample reference regions is p, p is a positive integer less than or equal to n, the first characteristic value u({circumflex over (B)}) includes u.sub.t, Π.sub.t=Σ.sub.i=1.sup.pg.sub.t(s.sub.i), s.sub.i is a detection accuracy value corresponding to the i.sup.th reference region in the sample reference regions, a function g.sub.t(s.sub.i) is a function of s.sub.i, the function g.sub.t(s.sub.i) is used as a weighting function of {circumflex over (b)}.sub.i, {circumflex over (b)}.sub.i is the normalized coordinate values of the sample reference regions, i is a positive integer less than or equal to p, {circumflex over (b)}.sub.i={{circumflex over (x)}.sub.1.sup.i,ŷ.sub.1.sup.i,{circumflex over (x)}.sub.2.sup.i,ŷ.sub.2.sup.i}, and {circumflex over (B)} represents the sample reference regions; and {circumflex over (x)}.sub.1.sup.i is the normalized horizontal coordinate, in the to-be-processed image, of the pixel that is located in the upper-left corner of the i.sup.th reference region in the sample reference regions, ŷ.sub.1.sup.i is a normalized vertical coordinate, in the to-be-processed image, of the pixel that is located in the upper-left corner of the i.sup.th reference region, {circumflex over (x)}.sub.2.sup.i is a normalized horizontal coordinate, in the to-be-processed image, of a pixel that is located in a lower-right corner of the i.sup.th reference region, and ŷ.sub.2.sup.i is a normalized vertical coordinate, in the to-be-processed image, of the pixel that is located in the lower-right corner of the i.sup.th reference region.

    13. The computer device according to claim 12, wherein the first characteristic value u({circumflex over (B)})=[u.sub.1, . . . , u.sub.d].sup.T, d is a positive integer, t is a positive integer less than or equal to d, u.sub.t is the t.sup.th characteristic value of the first characteristic value, the function g.sub.t(s.sub.i) is the t.sup.th weighting function of weighting functions of {circumflex over (b)}.sub.i, and the weighting functions of {circumflex over (b)}.sub.i comprise at least one of the following: g ( s i ) = exp ( ρ 1 .Math. s i ) , g ( s i ) = exp ( ρ 2 .Math. s i ) , g ( s i ) = exp ( ρ 3 .Math. s i ) , g ( s i ) = ( s i - τ 1 ) 1 2 , g ( s i ) = ( s i - τ 2 ) 1 2 , g ( s i ) = ( s i - τ 3 ) 1 2 , g ( s i ) = s i - τ 1 , g ( s i ) = s i - τ 2 , g ( s i ) = s i - τ 3 , g ( s i ) = min ( s i - τ 1 , 4 ) , g ( s i ) = min ( s i - τ 2 , 4 ) , g ( s i ) = min ( s i - τ 3 , 4 ) , g ( s i ) = 1 1 + exp ( - ρ 1 .Math. s i ) , g ( s i ) = 1 1 + exp ( - ρ 2 .Math. s i ) , g ( s i ) = 1 1 + exp ( - ρ 3 .Math. s i ) g ( s i ) = ( s i - τ 1 ) 2 , g ( s i ) = ( s i - τ 2 ) 2 , g ( s i ) = ( s i - τ 3 ) 2 , , wherein the ρ1, τ1, ρ2, τ2, ρ3, and τ3 are normalization coefficients.

    14. The computer device according to claim 10, wherein the characteristic values further comprise a second characteristic value, and a specific implementation manner of the determining, by the processor and based on the normalized coordinate values of the sample reference regions, characteristic values of the sample reference regions is: calculating, based on the following formula, the second characteristic value: M ( B ^ ) = 1 p .Math. D T .Math. D , wherein M({circumflex over (B)}) is the second characteristic value, the quantity of the sample reference regions is p, p is a positive integer less than or equal to n, a matrix D comprises the normalized coordinate values of the sample reference regions, the i.sup.th row in the matrix D comprises normalized coordinate value of the i.sup.th reference region in the sample reference regions, and {circumflex over (B)} represents the sample reference regions.

    15. The computer device according to claim 14, wherein a specific implementation manner of the determining, by the processor and based on the characteristic values, a coordinate value of the target region corresponding to the to-be-detected object is: calculating, according to the following formula, the coordinate value of the target region: h 1 ( B ^ ) = λ + Λ 1 T .Math. u ( B ^ ) + Λ 2 T .Math. m ( B ^ ) = Λ T .Math. R ( B ^ ) , wherein h.sup.1({circumflex over (B)}) is the coordinate value of the target region corresponding to the to-be-detected object, u({circumflex over (B)}) is the first characteristic value, m({circumflex over (B)}).sup.T is a vector form of the second characteristic value M({circumflex over (B)}), λ, Λ.sub.1, and Λ.sub.2 are coefficients, Λ=[λ,Λ.sub.1.sup.T,Λ.sub.2.sup.T].sup.T, R({circumflex over (B)})=[1, u({circumflex over (B)}).sup.T, m({circumflex over (B)}).sup.T].sup.T, and {circumflex over (B)} represents the sample reference regions.

    16. The computer device according to claim 15, wherein a value of the coefficient Λ is determined by using the following model: min Λ .Math. 1 2 .Math. Λ T .Math. Λ + C .Math. .Math. k = 1 K .Math. .Math. [ max ( 0 , .Math. Z ^ 1 k - h 1 ( B ^ k ) .Math. - ) ] 2 , wherein C and ε are preset values, K is a quantity of pre-stored training sets, {circumflex over (Z)}.sub.1.sup.k is a preset coordinate value of a target region corresponding to a reference region in the k.sup.th training set of the K training sets, and {circumflex over (B)}.sub.k represents the reference region in the k.sup.th training set.

    17. The method according to claim 2, wherein the characteristic values comprise a first characteristic value, and the determining, based on the normalized coordinate values of the sample reference regions, characteristic values of the sample reference regions comprises: calculating, based on the following formula, the first characteristic value: u l = 1 .Math. t .Math. .Math. .Math. i = 1 P .Math. .Math. g i ( s i ) .Math. b ^ i , wherein the quantity of the sample reference regions is p, p is a positive integer less than or equal to n, the first characteristic value u({circumflex over (B)}) includes u.sub.t, Π.sub.t=Σ.sub.i=1.sup.pg.sub.t(s.sub.i), s.sub.i is a detection accuracy value corresponding to the i.sup.th reference region in the sample reference regions, a function g.sub.t(s.sub.i) is a function of s.sub.i, the function g.sub.t(s.sub.i) is used as a weighting function of {circumflex over (b)}.sub.i, {circumflex over (b)}.sub.i is the normalized coordinate values of the sample reference regions, i is a positive integer less than or equal to p, {circumflex over (b)}.sub.i={{circumflex over (x)}.sub.1.sup.i,ŷ.sub.1.sup.i,{circumflex over (x)}.sub.2.sup.i,ŷ.sub.2.sup.i}, and {circumflex over (B)} represents the sample reference regions; and {circumflex over (x)}.sub.1.sup.i is the normalized horizontal coordinate, in the to-be-processed image, of the pixel that is located in the lower-left corner of the i.sup.th reference region in the sample reference regions, ŷ.sub.1.sup.i is a normalized vertical coordinate, in the to-be-processed image, of the pixel that is located in the lower-left corner of the i.sup.th reference region, {circumflex over (x)}.sub.2.sup.i is a normalized horizontal coordinate, in the to-be-processed image, of a pixel that is located in an upper-right corner of the i.sup.th reference region, and ŷ.sub.2.sup.i is a normalized vertical coordinate, in the to-be-processed image, of the pixel that is located in the upper-right corner of the i.sup.th reference region.

    18. The method according to claim 17, wherein the first characteristic value u({circumflex over (B)})=[u.sub.1, . . . , u.sub.d].sup.T, d is a positive integer, t is a positive integer less than or equal to d, u.sub.t is the t.sup.th characteristic value of the first characteristic value, the function g.sub.t(s.sub.i) is the t.sup.th weighting function of weighting functions of {circumflex over (b)}.sub.i, and the weighting functions of {circumflex over (b)}.sub.i comprise at least one of the following: g ( s i ) = exp ( ρ 1 .Math. s i ) , g ( s i ) = exp ( ρ 2 .Math. s i ) , g ( s i ) = exp ( ρ 3 .Math. s i ) , g ( s i ) = ( s i - τ 1 ) 1 2 , g ( s i ) = ( s i - τ 2 ) 1 2 , g ( s i ) = ( s i - τ 3 ) 1 2 , g ( s i ) = s i - τ 1 , g ( s i ) = s i - τ 2 , g ( s i ) = s i - τ 3 , g ( s i ) = min ( s i - τ 1 , 4 ) , g ( s i ) = min ( s i - τ 2 , 4 ) , g ( s i ) = min ( s i - τ 3 , 4 ) , g ( s i ) = 1 1 + exp ( - ρ 1 .Math. s i ) , g ( s i ) = 1 1 + exp ( - ρ 2 .Math. s i ) , g ( s i ) = 1 1 + exp ( - ρ 3 .Math. s i ) g ( s i ) = ( s i - τ 1 ) 2 , g ( s i ) = ( s i - τ 2 ) 2 , g ( s i ) = ( s i - τ 3 ) 2 , , wherein the ρ1, τ1, ρ2, τ2, ρ3, and τ3 are normalization coefficients.

    19. The computer device according to claim 10, wherein the characteristic values comprise a first characteristic value, and a specific implementation manner of the determining, by the processor and based on the normalized coordinate values of the sample reference regions, characteristic values of the sample reference regions is: calculating, based on the following formula, the first characteristic value: u l = 1 .Math. t .Math. .Math. .Math. i = 1 P .Math. .Math. g i ( s i ) .Math. b ^ i , wherein the quantity of the sample reference regions is p, p is a positive integer less than or equal to n, the first characteristic value u({circumflex over (B)}) includes u.sub.t, Π.sub.t=Σ.sub.i=1.sup.pg.sub.t(s.sub.i), s.sub.i is a detection accuracy value corresponding to the i.sup.th reference region in the sample reference regions, a function g.sub.t(s.sub.i) is a function of s.sub.i, the function g.sub.t(s.sub.i) is used as a weighting function of {circumflex over (b)}.sub.i, {circumflex over (b)}.sub.i is the normalized coordinate values of the sample reference regions, i is a positive integer less than or equal to p, {circumflex over (b)}.sub.i={{circumflex over (x)}.sub.1.sup.i,ŷ.sub.1.sup.i,{circumflex over (x)}.sub.2.sup.i,ŷ.sub.2.sup.i}, and {circumflex over (B)} represents the sample reference regions; and {circumflex over (x)}.sub.1.sup.i is the normalized horizontal coordinate, in the to-be-processed image, of the pixel that is located in the lower-left corner of the i.sup.th reference region in the sample reference regions, ŷ.sub.1.sup.i is a normalized vertical coordinate, in the to-be-processed image, of the pixel that is located in the lower-left corner of the i.sup.th reference region, {circumflex over (x)}.sub.2.sup.i is a normalized horizontal coordinate, in the to-be-processed image, of a pixel that is located in an upper-right corner of the i.sup.th reference region, and ŷ.sub.2.sup.i is a normalized vertical coordinate, in the to-be-processed image, of the pixel that is located in the upper-right corner of the i.sup.th reference region.

    20. The computer device according to claim 19, wherein the first characteristic value u({circumflex over (B)})=[u.sub.1, . . . , u.sub.d].sup.T, d is a positive integer, t is a positive integer less than or equal to d, u.sub.t is the t.sup.th characteristic value of the first characteristic value, the function g.sub.t(s.sub.i) is the t.sup.th weighting function of weighting functions of {circumflex over (b)}.sub.i, and the weighting functions of {circumflex over (b)}.sub.i comprise at least one of the following: g ( s i ) = exp ( ρ 1 .Math. s i ) , g ( s i ) = exp ( ρ 2 .Math. s i ) , g ( s i ) = exp ( ρ 3 .Math. s i ) , g ( s i ) = ( s i - τ 1 ) 1 2 , g ( s i ) = ( s i - τ 2 ) 1 2 , g ( s i ) = ( s i - τ 3 ) 1 2 , g ( s i ) = s i - τ 1 , g ( s i ) = s i - τ 2 , g ( s i ) = s i - τ 3 , g ( s i ) = min ( s i - τ 1 , 4 ) , g ( s i ) = min ( s i - τ 2 , 4 ) , g ( s i ) = min ( s i - τ 3 , 4 ) , g ( s i ) = 1 1 + exp ( - ρ 1 .Math. s i ) , g ( s i ) = 1 1 + exp ( - ρ 2 .Math. s i ) , g ( s i ) = 1 1 + exp ( - ρ 3 .Math. s i ) g ( s i ) = ( s i - τ 1 ) 2 , g ( s i ) = ( s i - τ 2 ) 2 , g ( s i ) = ( s i - τ 3 ) 2 , , wherein the ρ1, τ1, ρ2, τ2, ρ3, and τ3 are normalization coefficients.

    Description

    BRIEF DESCRIPTION OF DRAWINGS

    [0079] To describe the technical solutions in the embodiments of the present invention more clearly, the following briefly describes the accompanying drawings required for describing the embodiments. Apparently, the accompanying drawings in the following description show merely some embodiments of the present invention, and a person of ordinary skill in the art may still derive other drawings from these accompanying drawings without creative efforts.

    [0080] FIG. 1 is a schematic diagram of detecting a location of an object in an image in the prior art;

    [0081] FIG. 2 is a schematic diagram of detecting a location of an object in an image by using a potential region classification method in the prior art;

    [0082] FIG. 3 is a schematic structural diagram of a computer device according to an embodiment of the present invention;

    [0083] FIG. 4 is a schematic flowchart of an object detection method according to a method embodiment of the present invention; and

    [0084] FIG. 5 is a composition block diagram of functional units of a computer device according to an apparatus embodiment of the present invention.

    DESCRIPTION OF EMBODIMENTS

    [0085] The following clearly describes the technical solutions in the embodiments of the present invention with reference to the accompanying drawings in the embodiments of the present invention.

    [0086] In the specification, claims, and accompanying drawings of the present invention, the terms “first”, “second”, “third”, “fourth”, and so on are intended to distinguish between different objects but do not indicate a particular order. In addition, the terms “include”, “contain”, and any other variants thereof are intended to cover a non-exclusive inclusion. For example, a process, a method, a system, a product, or a device that includes a series of steps or units is not limited to the listed steps or units, but optionally further includes an unlisted step or unit, or optionally further includes another inherent step or unit of the process, the method, the product, or the device.

    [0087] To facilitate understanding of the embodiments of the present invention, the following first briefly describes a method of detecting a location of a to-be-detected object in an image by a computer device in the prior art. The computer device first generates, by using a potential region classification method, multiple reference regions used to identify the to-be-detected object, classifies the reference regions by using a region based convolutional neural network (Region Based Convolutional Neural Network, RCNN) classifier, determines detection accuracy values, of the to-be-detected object, corresponding to the reference regions, and then, selects a reference region corresponding to a maximum detection accuracy value as a target region of the to-be-detected object. After a detection accuracy value of a reference region in the image is high enough, a score of the reference region and actual location accuracy of the reference region are not strongly correlated (a Pearson correlation coefficient is lower than 0.3), which makes it difficult to guarantee accuracy of the finally determined target region of the to-be-detected object.

    [0088] Based on this, an object detection method is proposed in the solutions of the present invention. After obtaining n reference regions used to identify a to-be-detected object in a to-be-processed image, and n detection accuracy values, of the to-be-detected object, corresponding to the n reference regions, and determining sample reference regions in the n reference regions, a computer device may determine, based on the sample reference regions, a target region corresponding to the to-be-detected object, where the target region is used to identify the to-be-detected object in the to-be-processed image, coincidence degrees of the sample reference regions is greater than a preset threshold, and the coincidence degrees of the sample reference regions is coincidence degrees between the sample reference regions and a reference region that corresponds to a maximum value in the n detection accuracy values. It can be learned that, in the embodiments of the present invention, a reference region with a relatively high region coincidence degree is not simply deleted, and instead, sample reference regions with relatively high quality is used to predict a location of a target region of an object, with a relationship of the sample reference regions being fully considered, which helps improve accuracy of detecting a location of the object.

    [0089] A detailed description is given below.

    [0090] Referring to FIG. 3, FIG. 3 is a schematic structural diagram of a computer device according to an embodiment of the present invention. The computer device includes at least one processor 301, a communications bus 302, a memory 303, and at least one communications interface 304. The processor 301 may be a general purpose central processing unit (CPU), a microprocessor, an application-specific integrated circuit (ASIC), or one or more integrated circuits used to control program execution of the solutions of the present invention. The communications bus 302 may include a channel and transfers information between the foregoing components. The communications interface 304 may be an apparatus using a transceiver or the like, and is configured to communicate with another device or a communications network, such as an Ethernet, a radio access network (RAN), or a wireless local area network (WLAN). The memory 303 may be a read-only memory (read-only memory, ROM) or another type of static storage device that may store static information and instructions, or a random access memory (RAM) or another type of dynamic storage device that may store information and instructions, and may also be an electrically erasable programmable read-only memory (EEPROM), a read-only optical disc (Compact Disc Read-Only Memory, CD-ROM), another optical disc storage medium, optical disc storage medium (including a compact disc, a laser disc, an optical disc, a digital versatile disc, a Blu-ray disc, or the like), or magnetic disc storage medium, another magnetic storage device, or any other medium that can be used to carry or store expected program code in a structural form of an instruction or data and that can be accessed by a computer, but is not limited thereto.

    [0091] The computer device may further include an output device 305 and an input device 306. The output device 305 communicates with the processor 301 and may display information in multiple manners. The input device 306 communicates with the processor 301 and may accept an input from a user in multiple manners.

    [0092] In specific implementation, the foregoing computer device may be, for example, a desktop computer, a portable computer, a network server, a palm computer (Personal Digital Assistant, PDA), a mobile phone, a tablet computer, a wireless terminal device, a communications device, an embedded device, or a device that has a structure similar to the structure shown in FIG. 3. A type of the computer device is not limited in this embodiment of the present invention.

    [0093] The processor 301 in the foregoing computer device can couple the at least one memory 303. The memory 303 pre-stores program code, where the program code specifically includes an obtaining module, a first determining module, and a second determining module. In addition, the memory 303 further stores a kernel module, where the kernel module includes an operating system (for example, WINDOWS™, ANDROID™, or IOS™).

    [0094] The processor 301 of the computer device invokes the program code to execute the object detection method disclosed in this embodiment of the present invention, which specifically includes the following steps:

    [0095] running, by the processor 301 of the computer device, the obtaining module in the memory 303, to obtain a to-be-processed image, and obtain, according to the to-be-processed image, n reference regions used to identify a to-be-detected object in the to-be-processed image, and n detection accuracy values, of the to-be-detected object, corresponding to the n reference regions, where n is an integer greater than 1, where

    [0096] the detection accuracy values, of the to-be-detected object, corresponding to the reference regions may be obtained by means of calculation by using a region based convolutional neural network (Region Based Convolutional Neural Network, RCNN) classifier;

    [0097] running, by the processor 301 of the computer device, the first determining module in the memory 303, to determine sample reference regions in the n reference regions, where coincidence degrees between the sample reference regions and a reference region that corresponds to a maximum value in the n detection accuracy values is greater than a preset threshold, where

    [0098] if a coincidence degree corresponding to two reference regions that completely coincide is 1, the preset threshold may be, for example, 0.99 or 0.98; or if a coincidence degree corresponding to two reference regions that completely coincide is 100, the preset threshold may be, for example, 99, 98, or 95, and the preset threshold may be set by a user in advance; and

    [0099] running, by the processor 301 of the computer device, the second determining module in the memory 303, to determine, based on the sample reference regions, a target region corresponding to the to-be-detected object, where the target region is used to identify the to-be-detected object in the to-be-processed image.

    [0100] It can be learned that the computer device provided in this embodiment of the present invention does not simply delete a reference region with a relatively high region coincidence degree, and instead, uses sample reference regions with relatively high quality to predict a location of a target region of an object, with a relationship of the sample reference regions being fully considered, which helps improve accuracy of detecting a location of the object.

    [0101] Optionally, after the processor 301 determines the target region corresponding to the to-be-detected object, the processor 301 is further configured to:

    [0102] output the to-be-processed image with the target region identified.

    [0103] Optionally, a specific implementation manner of the determining, by the processor 301 and based on the sample reference regions, a target region corresponding to the to-be-detected object is:

    [0104] normalizing coordinate values of the sample reference regions, to obtain normalized coordinate values of the sample reference regions, where the coordinate value of the sample reference regions is used to represent the sample reference regions;

    [0105] determining, based on the normalized coordinate values of the sample reference regions, characteristic values of the sample reference regions; and

    [0106] determining, based on the characteristic values, a coordinate value used to identify the target region corresponding to the to-be-detected object in the to-be-processed image.

    [0107] Optionally, a specific implementation manner of the normalizing, by the processor 301, a coordinate value of the sample reference regions, to obtain normalized coordinate values of the sample reference regions is:

    [0108] calculating, based on the following formula, the normalized coordinate values of the sample reference regions:

    [00013] x ^ 1 i = x 1 i - 1 2 .Math. .Math. .Math. j = 1 p .Math. .Math. I ( s j ) .Math. ( x 1 j + x 2 j ) 1 .Math. .Math. .Math. j = 1 p .Math. .Math. I ( s j ) .Math. ( x 2 j - x 1 j ) ,

    where P a quantity of the sample reference regions is p, p is a positive integer less than or equal to n, and x.sub.1.sup.i is a horizontal coordinate, in the to-be-processed image, of a pixel that is located in an upper-left corner of the i.sup.th reference region in the sample reference regions;

    [0109] x.sub.1.sup.j is a horizontal coordinate, in the to-be-processed image, of a pixel that is located in an upper-left corner of the j.sup.th reference region in the sample reference regions, x.sub.2.sup.j is a horizontal coordinate, in the to-be-processed image, of a pixel that is located in a lower-right corner of the j.sup.th reference region, and {circumflex over (x)}.sub.1.sup.i is a normalized horizontal ordinate of the pixel that is located in the upper-left corner of the i.sup.th reference region; or

    [0110] x.sub.1.sup.j is a horizontal coordinate, in the to-be-processed image, of a pixel that is located in a lower-left corner of the j.sup.th reference region, x.sub.2.sup.j is a horizontal coordinate, in the to-be-processed image, of a pixel that is located in an upper-right corner of the j.sup.th reference region, and {circumflex over (x)}.sub.1.sup.i is a normalized horizontal ordinate of a pixel that is located in a lower-left corner of the i.sup.th reference region; and

    [0111] I(s.sub.j) is an indicator function, where when a detection accuracy value s.sub.j corresponding to the j.sup.th reference region is greater than a preset accuracy value, I(s.sub.j) is 1, when a detection accuracy value s.sub.j corresponding to the j.sup.th reference region is less than or equal to the preset accuracy value, I(s.sub.j) is 0, Π=Σ.sub.j=1.sup.pI(s.sub.j), and both i and j are positive integers less than or equal to p.

    [0112] The preset accuracy value may be set by a user in advance, or may be a reference value obtained by means of calculation according to the maximum value in the n detection accuracy values, which is not uniquely limited in this embodiment of the present invention.

    [0113] In the normalization processing step in this embodiment of the present invention, a coordinate value of sample reference regions is normalized, which is conducive to reducing an impact of a reference region with a relatively low detection accuracy value on object detection accuracy, and further improves the object detection accuracy.

    [0114] Optionally, the characteristic values include a first characteristic value, and a specific implementation manner of the determining, by the processor 301 and based on the normalized coordinate values of the sample reference regions, characteristic values of the sample reference regions is:

    [0115] calculating, based on the following formula, the first characteristic value:

    [00014] u t = 1 .Math. t .Math. .Math. i = 1 p .Math. .Math. t ( s i ) .Math. b ^ i ,

    where

    [0116] the quantity of the sample reference regions is p, p is a positive integer less than or equal to n, the first characteristic value u({circumflex over (B)}) includes u.sub.t, Π.sub.t=Σ.sub.i=1.sup.pg.sub.t(s.sub.i), s.sub.i is a detection accuracy value corresponding to the i.sup.th reference region in the sample reference regions, a function g.sub.t(s.sub.i) is a function of s.sub.i, the function g.sub.t(s.sub.i) is used as a weighting function of {circumflex over (b)}.sub.i, {circumflex over (b)}.sub.i is the normalized coordinate values of the sample reference regions, i is a positive integer less than or equal to p, {circumflex over (b)}.sub.i={{circumflex over (x)}.sub.1.sup.i,ŷ.sub.1.sup.i,{circumflex over (x)}.sub.2.sup.i,ŷ.sub.2.sup.i}, and {circumflex over (B)} represents the sample reference regions; and

    [0117] {circumflex over (x)}.sub.1.sup.i is the normalized horizontal coordinate, in the to-be-processed image, of the pixel that is located in the upper-left corner of the i.sup.th reference region in the sample reference regions, ŷ.sub.1.sup.i is a normalized vertical coordinate, in the to-be-processed image, of the pixel that is located in the upper-left corner of the i.sup.th reference region, {circumflex over (x)}.sub.2.sup.i is a normalized horizontal coordinate, in the to-be-processed image, of a pixel that is located in a lower-right corner of the i.sup.th reference region, and ŷ.sub.2.sup.i is a normalized vertical coordinate, in the to-be-processed image, of the pixel that is located in the lower-right corner of the i.sup.th reference region; or

    [0118] {circumflex over (x)}.sub.1.sup.i is the normalized horizontal coordinate, in the to-be-processed image, of the pixel that is located in the lower-left corner of the i.sup.th reference region in the sample reference regions, ŷ.sub.1.sup.i is a normalized vertical coordinate, in the to-be-processed image, of the pixel that is located in the lower-left corner of the i.sup.th reference region, {circumflex over (x)}.sub.2.sup.i is a normalized horizontal coordinate, in the to-be-processed image, of a pixel that is located in an upper-right corner of the i.sup.th reference region, and ŷ.sub.2.sup.i is a normalized vertical coordinate, in the to-be-processed image, of the pixel that is located in the upper-right corner of the i.sup.th reference region.

    [0119] It should be noted that {circumflex over (b)}.sub.i={{circumflex over (x)}.sub.1.sup.i,ŷ.sub.1.sup.i,{circumflex over (x)}.sub.2.sup.i,ŷ.sub.2.sup.i} in the foregoing formula of u.sub.t specifically refers to:

    [0120] if a currently calculated first characteristic value is a first characteristic value corresponding to an x.sub.1 coordinate of the sample reference regions, {circumflex over (b)}.sub.i={circumflex over (x)}.sub.1.sup.i; if a currently calculated first characteristic value is a first characteristic value corresponding to a y.sub.1 coordinate of the sample reference regions, {circumflex over (b)}.sub.i=ŷ.sub.1.sup.i; if a currently calculated first characteristic value is a first characteristic value corresponding to an x.sub.2 coordinate of the sample reference regions, {circumflex over (b)}.sub.i={circumflex over (x)}.sub.2.sup.i; or if a currently calculated first characteristic value is a first characteristic value corresponding to a y.sub.2 coordinate of the sample reference regions, {circumflex over (b)}.sub.i=ŷ.sub.2.sup.i, where the x.sub.1 coordinate corresponds to the foregoing x.sub.1.sup.j coordinate, and the x.sub.2 coordinate corresponds to the foregoing x.sub.2.sup.j coordinate.

    [0121] In this embodiment of the present invention, because the first characteristic value is a weighted average of values obtained by using different weighting functions for coordinates of all sample reference regions, an impact of a coordinate value of each sample reference regions on a target region of a to-be-detected object is comprehensively considered for a coordinate value, of the target region of the to-be-detected object, that is determined based on the first characteristic value, which helps improve object detection accuracy.

    [0122] Optionally, the first characteristic value u({circumflex over (B)})=[u.sub.1, . . . , u.sub.d].sup.T, d is a positive integer, t is a positive integer less than or equal to d, u.sub.t is the t.sup.th characteristic value of the first characteristic value, the function g.sub.t(s.sub.i) is the t.sup.th weighting function of weighting functions of {circumflex over (b)}.sub.i, and the weighting functions of {circumflex over (b)}.sub.i include at least one of the following:

    [00015] .Math. .Math. ( s i ) = exp ( ρ 1 .Math. s i ) , .Math. .Math. ( s i ) = exp ( ρ 2 .Math. s i ) , .Math. .Math. ( s i ) = exp ( ρ 3 .Math. s i ) , .Math. .Math. ( s i ) = ( s i - τ 1 ) 1 2 , .Math. .Math. ( s i ) = ( s i - τ 2 ) 1 2 , .Math. .Math. ( s i ) = ( s i - τ 3 ) 1 2 , .Math. .Math. ( s i ) = s i - τ 1 , .Math. .Math. ( s i ) = s i - τ 2 , .Math. .Math. ( s i ) = s i - τ 3 , .Math. .Math. ( s i ) = min .Math. .Math. ( s i - τ 1 , 4 ) , .Math. .Math. ( s i ) = min .Math. .Math. ( s i - τ 2 , 4 ) , .Math. .Math. ( s i ) = min .Math. ( s i - τ 3 , 4 ) , .Math. .Math. ( s i ) = 1 1 + exp ( - ρ 1 .Math. s i ) , .Math. .Math. ( s i ) = 1 1 + exp ( - ρ 2 .Math. s i ) , .Math. .Math. ( s i ) = 1 1 + exp ( - ρ 3 .Math. s i ) .Math. .Math. ( s i ) = ( s i - τ 1 ) 2 , .Math. .Math. ( s i ) = ( s i - τ 2 ) 2 , .Math. .Math. ( s i ) = ( s i - τ 3 ) 2 , ,

    where

    [0123] the ρ1, τ1, ρ2, τ2, ρ3, and τ3 are normalization coefficients.

    [0124] Optionally, the characteristic values further include a second characteristic value, and a specific implementation manner of the determining, by the processor 301 and based on the normalized coordinate values of the sample reference regions, characteristic values of the sample reference regions is:

    [0125] calculating, based on the following formula, the second characteristic value:

    [00016] M ( B ^ ) = 1 p .Math. D T .Math. D ,

    where

    [0126] M({circumflex over (B)}) is the second characteristic value, the quantity of the sample reference regions is p, p is a positive integer less than or equal to n, a matrix D includes the normalized coordinate values of the sample reference regions, the i.sup.th row in the matrix D includes normalized coordinate value of the i.sup.th reference region in the sample reference regions, and {circumflex over (B)} represents the sample reference regions.

    [0127] In this embodiment of the present invention, because the second characteristic value is obtained by means of calculation based on a matrix that includes a coordinate of sample reference regions, two-dimensional relationships of coordinates of different sample reference regions are comprehensively considered for a coordinate value, of a target region of a to-be-detected object, that is determined based on the second characteristic value, which helps improve object detection accuracy.

    [0128] Optionally, a specific implementation manner of the determining, by the processor 301 and based on the characteristic values, a coordinate value of the target region corresponding to the to-be-detected object is:

    [0129] calculating, according to the following formula, the coordinate value of the target region:

    [00017] h 1 ( ^ ) = .Math. f 0 ( ^ , Λ 0 ) + f 1 .Math. ( ^ , Λ 1 ) + f 2 .Math. .Math. ( ^ , Λ 2 ) = .Math. λ + Λ 1 T .Math. u ( ^ ) + Λ 2 T .Math. m ( ^ ) = .Math. Λ T .Math. R ( ^ ) ,

    where

    [0130] h.sup.1({circumflex over (B)}) is the coordinate value of the target region corresponding to the to-be-detected object, f.sub.0({circumflex over (B)}Λ.sub.0)=λ, f.sub.1({circumflex over (B)},Λ.sub.1)=Λ.sub.1.sup.Tu({circumflex over (B)}), f.sub.2({circumflex over (B)},Λ.sub.2)=Λ.sub.2.sup.Tm({circumflex over (B)}), u({circumflex over (B)}) is the first characteristic value, m({circumflex over (B)}).sup.T is a vector form of the second characteristic value M({circumflex over (B)}), λ, Λ.sub.1, and Λ.sub.2 are coefficients, Λ=[λ,Λ.sub.1.sup.T,Λ.sub.2.sup.T].sup.T, R({circumflex over (B)})=[1, u({circumflex over (B)}), m({circumflex over (B)}).sup.T].sup.T, and {circumflex over (B)} represents the sample reference regions.

    [0131] Optionally, a value of the coefficient Λ is determined by using the following model:

    [00018] min Λ .Math. 1 2 .Math. Λ T .Math. Λ + C .Math. .Math. k = 1 K .Math. [ max .Math. .Math. ( 0 , .Math. z ^ 1 k - h 1 ( ^ k ) .Math. - ) ] 2 ,

    where

    [0132] C and ε are preset values, K is a quantity of pre-stored training sets, {circumflex over (Z)}.sub.1.sup.k is a preset coordinate value of a target region corresponding to a reference region in the k.sup.th training set of the K training sets, and {circumflex over (B)}.sub.k represents the reference region in the k.sup.th training set.

    [0133] It can be learned that, in this embodiment of the present invention, after obtaining n reference regions used to identify a to-be-detected object in a to-be-processed image, and n detection accuracy values, of the to-be-detected object, corresponding to the n reference regions, and determining sample reference regions in the n reference regions, a computer device may determine, based on the sample reference regions, a target region corresponding to the to-be-detected object, where the target region is used to identify the to-be-detected object in the to-be-processed image, coincidence degrees of the sample reference regions is greater than a preset threshold, and the coincidence degrees of the sample reference regions is coincidence degrees between the sample reference regions and a reference region that corresponds to a maximum value in the n detection accuracy values. It can be learned that, in this embodiment of the present invention, a reference region with a relatively high region coincidence degree is not simply deleted, and instead, sample reference regions with relatively high quality is used to predict a location of a target region of an object, with a relationship of the sample reference regions being fully considered, which helps improve accuracy of detecting a location of the object.

    [0134] Being consistent with the foregoing technical solutions, referring to FIG. 4, FIG. 4 is a schematic flowchart of an object detection method according to a method embodiment of the present invention. It should be noted that, although the object detection method disclosed in this method embodiment can be implemented based on an entity apparatus of the computer device shown in FIG. 3, the foregoing example computer device does not constitute a unique limitation on the object detection method disclosed in this method embodiment of the present invention.

    [0135] As shown in FIG. 4, the object detection method includes the following steps:

    [0136] S401: A computer device obtains a to-be-processed image.

    [0137] S402: The computer device obtains, according to the to-be-processed image, n reference regions used to identify a to-be-detected object in the to-be-processed image, and n detection accuracy values, of the to-be-detected object, corresponding to the n reference regions, where n is an integer greater than 1.

    [0138] The detection accuracy values, of the to-be-detected object, corresponding to the reference regions may be obtained by means of calculation by using a region based convolutional neural network (Region Based Convolutional Neural Network, RCNN) classifier.

    [0139] S403: The computer device determines sample reference regions in the n reference regions, where coincidence degrees between the sample reference regions and a reference region that corresponds to a maximum value in the n detection accuracy values is greater than a preset threshold.

    [0140] If a coincidence degree corresponding to two reference regions that completely coincide is 1, the preset threshold may be, for example, 0.99 or 0.98; or if a coincidence degree corresponding to two reference regions that completely coincide is 100, the preset threshold may be, for example, 99, 98, or 95. The preset threshold may be set by a user in advance.

    [0141] S404: The computer device determines, based on the sample reference regions, a target region corresponding to the to-be-detected object, where the target region is used to identify the to-be-detected object in the to-be-processed image.

    [0142] It can be learned that, in this embodiment of the present invention, after obtaining n reference regions used to identify a to-be-detected object in a to-be-processed image, and n detection accuracy values, of the to-be-detected object, corresponding to the n reference regions, and determining sample reference regions in the n reference regions, a computer device may determine, based on the sample reference regions, a target region corresponding to the to-be-detected object, where the target region is used to identify the to-be-detected object in the to-be-processed image, coincidence degrees of the sample reference regions is greater than a preset threshold, and the coincidence degrees of the sample reference regions is coincidence degrees between the sample reference regions and a reference region that corresponds to a maximum value in the n detection accuracy values. It can be learned that, in this embodiment of the present invention, a reference region with a relatively high region coincidence degree is not simply deleted, and instead, sample reference regions with relatively high quality is used to predict a location of a target region of an object, with a relationship of the sample reference regions being fully considered, which helps improve accuracy of detecting a location of the object.

    [0143] Optionally, in this embodiment of the present invention, after the computer device determines the target region corresponding to the to-be-detected object, the computer device is further configured to:

    [0144] output the to-be-processed image with the target region identified.

    [0145] Optionally, in this embodiment of the present invention, a specific implementation manner of the determining, by the computer device and based on the sample reference regions, a target region corresponding to the to-be-detected object is:

    [0146] normalizing, by the computer device, a coordinate value of the sample reference regions, to obtain normalized coordinate values of the sample reference regions, where the coordinate value of the sample reference regions is used to represent the sample reference regions;

    [0147] determining, by the computer device and based on the normalized coordinate values of the sample reference regions, characteristic values of the sample reference regions; and

    [0148] determining, by the computer device and based on the characteristic values, a coordinate value used to identify the target region corresponding to the to-be-detected object in the to-be-processed image.

    [0149] Optionally, in this embodiment of the present invention, a specific implementation manner of the normalizing, by the computer device, a coordinate value of the sample reference regions, to obtain normalized coordinate values of the sample reference regions is:

    [0150] calculating, by the computer device and based on the following formula, the normalized coordinate values of the sample reference regions:

    [00019] x ^ 1 i = x 1 i - 1 2 .Math. Π .Math. .Math. j = 1 p .Math. I ( s j ) .Math. ( x 1 j + x 2 j ) 1 Π .Math. .Math. j = 1 p .Math. I ( s j ) .Math. ( x 2 j - x 1 j ) ,

    where

    [0151] a quantity of the sample reference regions is p, p is a positive integer less than or equal to n, and x.sub.1.sup.i is a horizontal coordinate, in the to-be-processed image, of a pixel that is located in an upper-left corner of the i.sup.th reference region in the sample reference regions;

    [0152] x.sub.1.sup.j is a horizontal coordinate, in the to-be-processed image, of a pixel that is located in an upper-left corner of the j.sup.th reference region in the sample reference regions, x.sub.2.sup.j is a horizontal coordinate, in the to-be-processed image, of a pixel that is located in a lower-right corner of the j.sup.th reference region, and {circumflex over (x)}.sub.1.sup.i is a normalized horizontal ordinate of the pixel that is located in the upper-left corner of the i.sup.th reference region; or

    [0153] x.sub.1.sup.j is a horizontal coordinate, in the to-be-processed image, of a pixel that is located in a lower-left corner of the j.sup.th reference region, x.sub.2.sup.j is a horizontal coordinate, in the to-be-processed image, of a pixel that is located in an upper-right corner of the j.sup.th reference region, and {circumflex over (x)}.sub.1.sup.i is a normalized horizontal ordinate of a pixel that is located in a lower-left corner of the i.sup.th reference region; and

    [0154] I(s.sub.j) is an indicator function, where when a detection accuracy value s.sub.j corresponding to the j.sup.th reference region is greater than a preset accuracy value, I(s.sub.j) is 1, when a detection accuracy value s.sub.j corresponding to the j.sup.th reference region is less than or equal to the preset accuracy value, I(s.sub.j) is 0, Π=Σ.sub.j=1.sup.pI(s.sub.j), and both i and j are positive integers less than or equal to p.

    [0155] The preset accuracy value may be set by a user in advance, or may be a reference value obtained by means of calculation according to the maximum value in the n detection accuracy values, which is not uniquely limited in this embodiment of the present invention.

    [0156] Optionally, in this embodiment of the present invention, the characteristic values include a first characteristic value, and a specific implementation manner of the determining, by the computer device and based on the normalized coordinate values of the sample reference regions, characteristic values of the sample reference regions is:

    [0157] calculating, by the computer device and based on the following formula, the first characteristic value:

    [00020] u t = 1 Π t .Math. .Math. i = 1 p .Math. t ( s i ) .Math. b ^ i ,

    where

    [0158] the quantity of the sample reference regions is p, p is a positive integer less than or equal to n, the first characteristic value u({circumflex over (B)}) includes u.sub.t, Π.sub.t=Σ.sub.i=1.sup.pg.sub.t(s.sub.i), s.sub.i is a detection accuracy value corresponding to the i.sup.th reference region in the sample reference regions, a function g.sub.t(s.sub.i) is a function of s.sub.i, the function g.sub.t(s.sub.i) is used as a weighting function of {circumflex over (b)}.sub.i, {circumflex over (b)}.sub.i is the normalized coordinate values of the sample reference regions, i is a positive integer less than or equal to p, {circumflex over (b)}.sub.i={{circumflex over (x)}.sub.1.sup.i,ŷ.sub.1.sup.i,{circumflex over (x)}.sub.2.sup.i,ŷ.sub.2.sup.i}, and {circumflex over (B)} represents the sample reference regions; and

    [0159] {circumflex over (x)}.sub.1.sup.i is the normalized horizontal coordinate, in the to-be-processed image, of the pixel that is located in the upper-left corner of the i.sup.th reference region in the sample reference regions, ŷ.sub.1.sup.i is a normalized vertical coordinate, in the to-be-processed image, of the pixel that is located in the upper-left corner of the i.sup.th reference region, {circumflex over (x)}.sub.2.sup.i is a normalized horizontal coordinate, in the to-be-processed image, of a pixel that is located in a lower-right corner of the i.sup.th reference region, and ŷ.sub.2.sup.i is a normalized vertical coordinate, in the to-be-processed image, of the pixel that is located in the lower-right corner of the i.sup.th reference region; or

    [0160] {circumflex over (x)}.sub.1.sup.i is the normalized horizontal coordinate, in the to-be-processed image, of the pixel that is located in the lower-left corner of the i.sup.th reference region in the sample reference regions, ŷ.sub.1.sup.i is a normalized vertical coordinate, in the to-be-processed image, of the pixel that is located in the lower-left corner of the i.sup.th reference region, {circumflex over (x)}.sub.2.sup.i is a normalized horizontal coordinate, in the to-be-processed image, of a pixel that is located in an upper-right corner of the i.sup.th reference region, and ŷ.sub.2.sup.i is a normalized vertical coordinate, in the to-be-processed image, of the pixel that is located in the upper-right corner of the i.sup.th reference region.

    [0161] It should be noted that {circumflex over (b)}.sub.i={{circumflex over (x)}.sub.1.sup.i,ŷ.sub.1.sup.i,{circumflex over (x)}.sub.2.sup.i,ŷ.sub.2.sup.i} in the foregoing formula of u.sub.t specifically refers to:

    [0162] if a currently calculated first characteristic value is a first characteristic value corresponding to an x.sub.1 coordinate of the sample reference regions, {circumflex over (b)}.sub.i={circumflex over (x)}.sub.1.sup.i; if a currently calculated first characteristic value is a first characteristic value corresponding to a y.sub.1 coordinate of the sample reference regions, {circumflex over (b)}.sub.i=ŷ.sub.1.sup.i; if a currently calculated first characteristic value is a first characteristic value corresponding to an x.sub.2 coordinate of the sample reference regions, {circumflex over (b)}.sub.i={circumflex over (x)}.sub.2.sup.i; or if a currently calculated first characteristic value is a first characteristic value corresponding to a y.sub.2 coordinate of the sample reference regions, {circumflex over (b)}.sub.i=ŷ.sub.2.sup.i, where the x.sub.1 coordinate corresponds to the foregoing x.sub.1.sup.j coordinate, and the x.sub.2 coordinate corresponds to the foregoing x.sub.2.sup.j coordinate.

    [0163] Optionally, in this embodiment of the present invention, the first characteristic value u({circumflex over (B)})=[u.sub.1, . . . , u.sub.d].sup.T, d is a positive integer, t is a positive integer less than or equal to d, u.sub.t is the t.sup.th characteristic value of the first characteristic value, the function g.sub.t(s.sub.i) is the t.sup.th weighting function of weighting functions of {circumflex over (b)}.sub.i, and the weighting functions of {circumflex over (b)}.sub.i include at least one of the following:

    [00021] ( s i ) = exp ( ρ 1 .Math. s i ) , ( s i ) = exp ( ρ 2 .Math. s i ) , ( s i ) = ( s i - τ 1 ) 1 2 , ( s i ) = ( s i - τ 2 ) 1 2 , ( s i ) = s i - τ 1 , ( s i ) = s i - τ 2 , ( s i ) = min .Math. .Math. ( s i - τ 1 .Math. 4 ) , ( s i ) = min .Math. .Math. ( s i - τ 2 .Math. 4 ) , ( s i ) = 1 1 + exp ( - ρ 1 .Math. s i ) , ( s i ) = 1 1 + exp ( - ρ 2 .Math. s i ) , ( s i ) = ( s i - τ 1 ) 2 , ( s i ) = ( s i - τ 2 ) 2 , ( s i ) = exp ( ρ 3 .Math. s i ) , ( s i ) = ( s i - τ 3 ) 1 2 , ( s i ) = s i - τ 3 ( s i ) = min .Math. .Math. ( s i - τ 3 .Math. 4 ) , ( s i ) = 1 1 + exp ( - ρ 3 .Math. s i ) ( s i ) = ( s i - τ 3 ) 2 , ,

    where

    [0164] the ρ1, τ1, ρ2, τ2, ρ3, and τ3 are normalization coefficients.

    [0165] Optionally, in this embodiment of the present invention, the characteristic values further include a second characteristic value, and a specific implementation manner of the determining, by the computer device and based on the normalized coordinate values of the sample reference regions, characteristic values of the sample reference regions is:

    [0166] calculating, by the computer device and based on the following formula, the second characteristic value:

    [00022] M ( ^ ) = 1 p .Math. D T .Math. D ,

    where

    [0167] M({circumflex over (B)}) is the second characteristic value, the quantity of the sample reference regions is p, p is a positive integer less than or equal to n, a matrix D includes the normalized coordinate values of the sample reference regions, the i.sup.th row in the matrix D includes normalized coordinate value of the i.sup.th reference region in the sample reference regions, and {circumflex over (B)} represents the sample reference regions.

    [0168] Optionally, in this embodiment of the present invention, a specific implementation manner of the determining, by the computer device and based on the characteristic values, a coordinate value of the target region corresponding to the to-be-detected object is:

    [0169] calculating, by the computer device and according to the following formula, the coordinate value of the target region:

    [00023] h 1 ( ^ ) = .Math. f 0 ( ^ , Λ 0 ) + f 1 .Math. ( ^ , Λ 1 ) + f 2 .Math. .Math. ( ^ , Λ 2 ) = .Math. λ + Λ 1 T .Math. u ( ^ ) + Λ 2 T .Math. m ( ^ ) = .Math. Λ T .Math. R ( ^ ) ,

    where

    [0170] h.sup.1({circumflex over (B)}) is the coordinate value of the target region corresponding to the to-be-detected object, f.sub.0({circumflex over (B)}Λ.sub.0)=λ, f.sub.1({circumflex over (B)},Λ.sub.1)=Λ.sub.1.sup.Tu({circumflex over (B)}), f.sub.2({circumflex over (B)},Λ.sub.2)=Λ.sub.2.sup.Tm({circumflex over (B)}), u({circumflex over (B)}) is the first characteristic value, m({circumflex over (B)}).sup.T is a vector form of the second characteristic value M({circumflex over (B)}), λ, Λ.sub.1, and Λ.sub.2 are coefficients, Λ=[λ,Λ.sub.1.sup.T,Λ.sub.2.sup.T].sup.T, R({circumflex over (B)})=[1, u({circumflex over (B)}), m({circumflex over (B)}).sup.T].sup.T, and {circumflex over (B)} represents the sample reference regions.

    [0171] Optionally, in this embodiment of the present invention, a value of the coefficient Λ is determined by using the following model:

    [00024] min Λ .Math. 1 2 .Math. Λ T .Math. Λ + C .Math. .Math. k = 1 K .Math. [ max .Math. .Math. ( 0 , .Math. z ^ 1 k - h 1 ( ^ k ) .Math. - ) ] 2 ,

    where

    [0172] C and ε are preset values, K is a quantity of pre-stored training sets, {circumflex over (Z)}.sub.1.sup.k is a preset coordinate value of a target region corresponding to a reference region in the k.sup.th training set of the K training sets, and {circumflex over (B)}.sub.k represents the reference region in the k.sup.th training set.

    [0173] Some or all of the steps performed by the foregoing computer device may be specifically implemented by the computer device by executing software modules (program code) in the foregoing memory. For example, step S401 and step S402 may be implemented by the computer device by executing the obtaining module shown in FIG. 3; step S403 may be implemented by the computer device by executing the first determining module shown in FIG. 3; and step S404 may be implemented by the computer device by executing the second determining module shown in FIG. 3.

    [0174] The following is an apparatus embodiment of the present invention. Referring to FIG. 5, FIG. 5 is a composition block diagram of functional units of a computer device according to an apparatus embodiment of the present invention. As shown in FIG. 5, the computer device includes an obtaining unit 501, a first determining unit 502, and a second determining unit 503, where

    [0175] the obtaining unit 501 is configured to obtain a to-be-processed image;

    [0176] the obtaining unit 501 is further configured to obtain, according to the to-be-processed image, n reference regions used to identify a to-be-detected object in the to-be-processed image, and n detection accuracy values, of the to-be-detected object, corresponding to the n reference regions, where n is an integer greater than 1;

    [0177] the first determining unit 502 is configured to determine sample reference regions in the n reference regions, where coincidence degrees between the sample reference regions and a reference region that corresponds to a maximum value in the n detection accuracy values is greater than a preset threshold; and

    [0178] the second determining unit 503 is configured to determine, based on the sample reference regions, a target region corresponding to the to-be-detected object, where the target region is used to identify the to-be-detected object in the to-be-processed image.

    [0179] Optionally, the second determining unit 503 includes:

    [0180] a normalizing unit, configured to normalize a coordinate value of the sample reference regions, to obtain normalized coordinate values of the sample reference regions, where the coordinate value of the sample reference regions is used to represent the sample reference regions;

    [0181] a characteristic value determining unit, configured to determine, based on the normalized coordinate values of the sample reference regions, characteristic values of the sample reference regions; and

    [0182] a coordinate value determining unit, configured to determine, based on the characteristic values, a coordinate value used to identify the target region corresponding to the to-be-detected object in the to-be-processed image.

    [0183] Optionally, the normalizing unit is specifically configured to:

    [0184] calculate, based on the following formula, the normalized coordinate values of the sample reference regions:

    [00025] x ^ 1 i = x 1 i - 1 2 .Math. Π .Math. .Math. j = 1 p .Math. I ( s j ) .Math. ( x 1 j + x 2 j ) 1 Π .Math. .Math. j = 1 p .Math. I ( s j ) .Math. ( x 2 j - x 1 j ) ,

    where

    [0185] a quantity of the sample reference regions is p, p is a positive integer less than or equal to n, and x.sub.1.sup.i is a horizontal coordinate, in the to-be-processed image, of a pixel that is located in an upper-left corner of the i.sup.th reference region in the sample reference regions;

    [0186] x.sub.1.sup.j is a horizontal coordinate, in the to-be-processed image, of a pixel that is located in an upper-left corner of the j.sup.th reference region in the sample reference regions, x.sub.2.sup.j is a horizontal coordinate, in the to-be-processed image, of a pixel that is located in a lower-right corner of the j.sup.th reference region, and {circumflex over (x)}.sub.1.sup.i is a normalized horizontal ordinate of the pixel that is located in the upper-left corner of the i.sup.th reference region; or

    [0187] x.sub.1.sup.j is a horizontal coordinate, in the to-be-processed image, of a pixel that is located in a lower-left corner of the j.sup.th reference region, x.sub.2.sup.j is a horizontal coordinate, in the to-be-processed image, of a pixel that is located in an upper-right corner of the j.sup.th reference region, and {circumflex over (x)}.sub.1.sup.i is a normalized horizontal ordinate of a pixel that is located in a lower-left corner of the i.sup.th reference region; and

    [0188] I(s.sub.j) is an indicator function, where when a detection accuracy value s.sub.j corresponding to the j.sup.th reference region is greater than a preset accuracy value, I(s.sub.j) is 1, when a detection accuracy value s.sub.j corresponding to the j.sup.th reference region is less than or equal to the preset accuracy value, I(s.sub.j) is 0, Π=Σ.sub.j=1.sup.pI(s.sub.j), and both i and j are positive integers less than or equal to p.

    [0189] The preset accuracy value may be set by a user in advance, or may be a reference value obtained by means of calculation according to the maximum value in the n detection accuracy values, which is not uniquely limited in this embodiment of the present invention.

    [0190] Optionally, the characteristic values include a first characteristic value, and the characteristic value determining unit is specifically configured to:

    [0191] calculate, based on the following formula, the first characteristic value:

    [00026] u t = 1 Π t .Math. .Math. i = 1 p .Math. t ( s i ) .Math. b ^ i ,

    where

    [0192] the quantity of the sample reference regions is p, p is a positive integer less than or equal to n, the first characteristic value u({circumflex over (B)}) includes u.sub.t, Π.sub.t=Σ.sub.i=1.sup.pg.sub.t(s.sub.i), s.sub.i is a detection accuracy value corresponding to the i.sup.th reference region in the sample reference regions, a function g.sub.t(s.sub.i) is a function of s.sub.i, the function g.sub.t(s.sub.i) is used as a weighting function of {circumflex over (b)}.sub.i, {circumflex over (b)}.sub.i is the normalized coordinate values of the sample reference regions, i is a positive integer less than or equal to p, {circumflex over (b)}.sub.i={{circumflex over (x)}.sub.1.sup.i,ŷ.sub.1.sup.i,{circumflex over (x)}.sub.2.sup.i,ŷ.sub.2.sup.i}, and {circumflex over (B)} represents the sample reference regions; and

    [0193] {circumflex over (x)}.sub.1.sup.i is the normalized horizontal coordinate, in the to-be-processed image, of the pixel that is located in the upper-left corner of the i.sup.th reference region in the sample reference regions, ŷ.sub.1.sup.i is a normalized vertical coordinate, in the to-be-processed image, of the pixel that is located in the upper-left corner of the i.sup.th reference region, {circumflex over (x)}.sub.2.sup.i is a normalized horizontal coordinate, in the to-be-processed image, of a pixel that is located in a lower-right corner of the i.sup.th reference region, and ŷ.sub.2.sup.i is a normalized vertical coordinate, in the to-be-processed image, of the pixel that is located in the lower-right corner of the i.sup.th reference region; or

    [0194] {circumflex over (x)}.sub.1.sup.i is the normalized horizontal coordinate, in the to-be-processed image, of the pixel that is located in the lower-left corner of the i.sup.th reference region in the sample reference regions, ŷ.sub.1.sup.i is a normalized vertical coordinate, in the to-be-processed image, of the pixel that is located in the lower-left corner of the i.sup.th reference region, {circumflex over (x)}.sub.2.sup.i is a normalized horizontal coordinate, in the to-be-processed image, of a pixel that is located in an upper-right corner of the i.sup.th reference region, and ŷ.sub.2.sup.i is a normalized vertical coordinate, in the to-be-processed image, of the pixel that is located in the upper-right corner of the i.sup.th reference region.

    [0195] It should be noted that {circumflex over (b)}.sub.i={{circumflex over (x)}.sub.1.sup.i,ŷ.sub.1.sup.i,{circumflex over (x)}.sub.2.sup.i,ŷ.sub.2.sup.i} in the foregoing formula of u.sub.t specifically refers to:

    [0196] if a currently calculated first characteristic value is a first characteristic value corresponding to an x.sub.1 coordinate of the sample reference regions, {circumflex over (b)}.sub.i={circumflex over (x)}.sub.1.sup.i; if a currently calculated first characteristic value is a first characteristic value corresponding to a y.sub.1 coordinate of the sample reference regions, {circumflex over (b)}.sub.i=ŷ.sub.1.sup.i; if a currently calculated first characteristic value is a first characteristic value corresponding to an x.sub.2 coordinate of the sample reference regions, {circumflex over (b)}.sub.i={circumflex over (x)}.sub.2.sup.i; or if a currently calculated first characteristic value is a first characteristic value corresponding to a y.sub.2 coordinate of the sample reference regions, {circumflex over (b)}.sub.i=ŷ.sub.2.sup.i, where the x.sub.1 coordinate corresponds to the foregoing x.sub.1.sup.j coordinate, and the x.sub.2 coordinate corresponds to the foregoing x.sub.2.sup.j coordinate.

    [0197] Optionally, the first characteristic value u({circumflex over (B)})=[u.sub.1, . . . , u.sub.d].sup.T, d is a positive integer, t is a positive integer less than or equal to d, u.sub.t is the t.sup.th characteristic value of the first characteristic value, the function g.sub.t(s.sub.i) is the t.sup.th weighting function of weighting functions of {circumflex over (b)}.sub.i, and the weighting functions of {circumflex over (b)}.sub.i include at least one of the following:

    [00027] ( s i ) = exp ( ρ 1 .Math. s i ) , ( s i ) = exp ( ρ 2 .Math. s i ) , ( s i ) = ( s i - τ 1 ) 1 2 , ( s i ) = ( s i - τ 2 ) 1 2 , ( s i ) = s i - τ 1 , ( s i ) = s i - τ 2 , ( s i ) = min .Math. .Math. ( s i - τ 1 .Math. 4 ) , ( s i ) = min .Math. .Math. ( s i - τ 2 .Math. 4 ) , ( s i ) = 1 1 + exp ( - ρ 1 .Math. s i ) , ( s i ) = 1 1 + exp ( - ρ 2 .Math. s i ) , ( s i ) = ( s i - τ 1 ) 2 , ( s i ) = ( s i - τ 2 ) 2 , ( s i ) = exp ( ρ 3 .Math. s i ) , ( s i ) = ( s i - τ 3 ) 1 2 , ( s i ) = s i - τ 3 ( s i ) = min .Math. .Math. ( s i - τ 3 .Math. 4 ) , ( s i ) = 1 1 + exp ( - ρ 3 .Math. s i ) ( s i ) = ( s i - τ 3 ) 2 , ,

    where

    [0198] the ρ1, τ1, ρ2, τ2, ρ3, and τ3 are normalization coefficients.

    [0199] Optionally, the characteristic values further include a second characteristic value, and the characteristic value determining unit is specifically configured to:

    [0200] calculate, based on the following formula, the second characteristic value:

    [00028] M ( ^ ) = 1 p .Math. D T .Math. D ,

    where

    [0201] M({circumflex over (B)}) is the second characteristic value, the quantity of the sample reference regions is p, p is a positive integer less than or equal to n, a matrix D includes the normalized coordinate values of the sample reference regions, the i.sup.th row in the matrix D includes normalized coordinate value of the i.sup.th reference region in the sample reference regions, and {circumflex over (B)} represents the sample reference regions.

    [0202] Optionally, the coordinate value determining unit is specifically configured to:

    [0203] calculate, according to the following formula, the coordinate value of the target region:

    [00029] h 1 ( ^ ) = .Math. f 0 ( ^ , Λ 0 ) + f 1 .Math. ( ^ , Λ 1 ) + f 2 .Math. .Math. ( ^ , Λ 2 ) = .Math. λ + Λ 1 T .Math. u ( ^ ) + Λ 2 T .Math. m ( ^ ) = .Math. Λ T .Math. R ( ^ ) ,

    where

    [0204] h.sup.1({circumflex over (B)}) is the coordinate value of the target region corresponding to the to-be-detected object, f.sub.0({circumflex over (B)}Λ.sub.0)=λ, f.sub.1({circumflex over (B)},Λ.sub.1)=Λ.sub.1.sup.Tu({circumflex over (B)}), f.sub.2({circumflex over (B)},Λ.sub.2)=Λ.sub.2.sup.Tm({circumflex over (B)}), u({circumflex over (B)}) is the first characteristic value, m({circumflex over (B)}).sup.T is a vector form of the second characteristic value M({circumflex over (B)}), λ, Λ.sub.1, and Λ.sub.2 are coefficients, Λ=[λ,Λ.sub.1.sup.T,Λ.sub.2.sup.T].sup.T, R({circumflex over (B)})=[1, u({circumflex over (B)}), m({circumflex over (B)}).sup.T].sup.T, and {circumflex over (B)} represents the sample reference regions.

    [0205] Optionally, a value of the coefficient Λ is determined by using the following model:

    [00030] min Λ .Math. 1 2 .Math. Λ T .Math. Λ + C .Math. .Math. k = 1 K .Math. [ max .Math. .Math. ( 0 , .Math. z ^ 1 k - h 1 ( ^ k ) .Math. - ) ] 2 ,

    where

    [0206] C and ε are preset values, K is a quantity of pre-stored training sets, {circumflex over (Z)}.sub.1.sup.k is a preset coordinate value of a target region corresponding to a reference region in the k.sup.th training set of the K training sets, and {circumflex over (B)}.sub.k represents the reference region in the k.sup.th training set.

    [0207] It should be noted that the computer device described in this functional unit apparatus embodiment of the present invention is represented in a form of functional units. The term “unit” used herein should be understood as a meaning as broadest as possible. The unit is an object that is used to implement a function of each “unit”, and may be, for example, an integrated circuit ASIC or a single circuit; or is a processor (a shared processor, a dedicated processor, or a chipset) and a memory that are used to execute one or multiple software or firmware programs, a combinational logic circuit, and/or another appropriate component that provides and implements the foregoing functions.

    [0208] For example, a person skilled in the art may know that a composition form of a hardware carrier of the computer device may be specifically the computer device shown in FIG. 3, where

    [0209] a function of the obtaining unit 501 may be implemented by the processor 301 and the memory 303 in the computer device, where specifically, the processor 301 runs the obtaining module in the memory 303 to obtain a to-be-processed image and obtain, according to the to-be-processed image, n reference regions used to identify a to-be-detected object in the to-be-processed image, and n detection accuracy values, of the to-be-detected object, corresponding to the n reference regions;

    [0210] a function of the first determining unit 502 may be implemented by the processor 301 and the memory 303 in the computer device, where specifically, the processor 301 runs the first determining module in the memory 303 to determine sample reference regions in the n reference regions; and

    [0211] a function of the second determining unit 503 may be implemented by the processor 301 and the memory 303 in the computer device, where specifically, the processor 301 runs the second determining module in the memory 303 to determine, based on the sample reference regions, a target region corresponding to the to-be-detected object.

    [0212] It can be learned that, in this embodiment of the present invention, an obtaining unit of a computer device disclosed in this embodiment of the present invention first obtains a to-be-processed image and obtains, according to the to-be-processed image, n reference regions used to identify a to-be-detected object in the to-be-processed image, and n detection accuracy values, of the to-be-detected object, corresponding to the n reference regions; then, a first determining unit of the computer device determines sample reference regions in the n reference regions; and finally, a second determining unit of the computer device determines, based on the sample reference regions, a target region corresponding to the to-be-detected object, where coincidence degrees of the sample reference regions is greater than a preset threshold, and the coincidence degrees of the sample reference regions is coincidence degrees between the sample reference regions and a reference region that corresponds to a maximum value in the n detection accuracy values. It can be learned that, in this embodiment of the present invention, a reference region with a relatively high region coincidence degree is not simply deleted, and instead, sample reference regions with relatively high quality is used to predict a location of a target region of an object, with a relationship of the sample reference regions being fully considered, which helps improve accuracy of detecting a location of the object.

    [0213] A person of ordinary skill in the art may understand that all or some of the steps of the methods in the embodiments may be implemented by a program instructing relevant hardware. The program may be stored in a computer readable storage medium. The storage medium may include a flash memory, a read-only memory (Read-Only Memory, ROM), a random access memory (Random Access Memory, RAM), a magnetic disk, an optical disc, or the like.

    [0214] The object detection method and the computer device that are disclosed in the embodiments of the present invention have been described in detail above. The principle and the implementation manners of the present invention are described herein by using specific examples. The descriptions about the embodiments are merely provided to help understand the method and the core idea of the present invention. In addition, a person of ordinary skill in the art can make variations and modifications to the present invention regarding the specific implementation manners and the application scope, according to the idea of the present invention. Therefore, the content of this specification shall not be construed as a limitation on the present invention.