circe 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
data/ext/yunet.h ADDED
@@ -0,0 +1,38 @@
1
+ #ifndef __YUNET__
2
+ #define __YUNET__
3
+
4
+ #include <string>
5
+ #include <vector>
6
+ #include <array>
7
+ #include <utility>
8
+
9
+ #include <opencv2/dnn.hpp>
10
+
11
+
12
+ class YuNet
13
+ {
14
+
15
+ public:
16
+ typedef std::array<cv::Point, 5> Landmark;
17
+ typedef std::pair<cv::Rect, Landmark> Face;
18
+
19
+ private:
20
+ static constexpr int MODEL_WIDTH = 512;
21
+ static constexpr float CONF_THRESHOLD = 0.4f;
22
+ static constexpr float NMS_THRESHOLD = 0.3f;
23
+
24
+ const std::vector<float> VARIANCES = { 0.1f, 0.2f };
25
+ const std::vector<int> STEPS = { 8, 16, 32, 64 };
26
+ const std::vector<std::vector<int>> MIN_SIZES = {
27
+ { 10, 16, 24 }, { 32, 48 }, { 64, 96 }, { 128, 192, 256 } };
28
+
29
+ public:
30
+ YuNet(const std::string& model);
31
+ ~YuNet() {};
32
+ void process(const cv::Mat& img, std::vector<Face>& faces);
33
+
34
+ private:
35
+ cv::dnn::Net net;
36
+ };
37
+
38
+ #endif
@@ -0,0 +1,3 @@
1
+ class Circe
2
+ VERSION = '0.1.0'
3
+ end
data/lib/circe.rb ADDED
@@ -0,0 +1,13 @@
1
+ class Circe
2
+
3
+ private
4
+
5
+ # Don't know how to do it inside the c extension
6
+ DATA_DIR = File.join(__dir__, '..', 'data').freeze
7
+ ONNX_YOLO = File.join(DATA_DIR, 'yolov5s.onnx')
8
+ ONNX_YUNET = File.join(DATA_DIR, 'face_detection_yunet_2022mar.onnx')
9
+
10
+ end
11
+
12
+ require_relative 'circe/version'
13
+ require_relative 'circe/core'
metadata ADDED
@@ -0,0 +1,60 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: circe
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Stéphane D'Alu
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2023-02-03 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description: |2+
14
+
15
+ Face and object recognition
16
+
17
+ email:
18
+ - sdalu@sdalu.com
19
+ executables: []
20
+ extensions:
21
+ - ext/extconf.rb
22
+ extra_rdoc_files: []
23
+ files:
24
+ - circe.gemspec
25
+ - data/face_detection_yunet_2022mar.onnx
26
+ - data/yolov5s.onnx
27
+ - ext/camera_model.h
28
+ - ext/circe.cpp
29
+ - ext/extconf.rb
30
+ - ext/yolo.cpp
31
+ - ext/yolo.h
32
+ - ext/yunet.cpp
33
+ - ext/yunet.h
34
+ - lib/circe.rb
35
+ - lib/circe/version.rb
36
+ homepage: https://github.com/sdalu/ruby-circe
37
+ licenses:
38
+ - MIT
39
+ metadata: {}
40
+ post_install_message:
41
+ rdoc_options: []
42
+ require_paths:
43
+ - lib
44
+ required_ruby_version: !ruby/object:Gem::Requirement
45
+ requirements:
46
+ - - ">="
47
+ - !ruby/object:Gem::Version
48
+ version: '0'
49
+ required_rubygems_version: !ruby/object:Gem::Requirement
50
+ requirements:
51
+ - - ">="
52
+ - !ruby/object:Gem::Version
53
+ version: '0'
54
+ requirements: []
55
+ rubygems_version: 3.4.2
56
+ signing_key:
57
+ specification_version: 4
58
+ summary: Face and object recognition
59
+ test_files: []
60
+ ...