Skip to content

sdalu/ruby-circe

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Intro

Based on model from YuNet for face detection, and YOLOv8 with COCO training for object classification.

Types

:class, box, name, confidence
:face,  box, landmark, confidence

name       : String
box        : [ x: Integer, y: Integer, width: Integer, height: Integer ]
confidence : Float
landmark   : [ left_eye           : [ x: Integer, y: Integer ],
               right_eye          : [ x: Integer, y: Integer ],
               nose_tip           : [ x: Integer, y: Integer ],
               left_corner_mouth  : [ x: Integer, y: Integer ],
               right_corner_mouth : [ x: Integer, y: Integer ] ]

Example

require 'circe'

$circe = Circe::new

img = File.read('foo.jpg')
features, out = $circe.analyze(img, :jpg) do |type, box, *args, confidence|
    case type
    when :class
        name, = args
        next nil unless [ 'person' ].include?(name)
        [ "%s: %.2f" % [ name, confidence ], 0xff00f0, 5 ]
    when :face
        "face"
    end
end

File.write('foo-annotated.jpg', out)

See

Credit

  • camera_model.h from iwatake2222

About

Face and object recognition

Resources

Stars

Watchers

Forks

Packages

No packages published