MCPcopy Create free account
hub / github.com/davisking/dlib / bind_shape_predictors

Function bind_shape_predictors

tools/python/src/shape_predictor.cpp:167–358  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

165// ----------------------------------------------------------------------------------------
166
167void bind_shape_predictors(py::module &m)
168{
169 {
170 typedef full_object_detection type;
171 py::class_<type, std::shared_ptr<type>>(m, "full_object_detection",
172 "This object represents the location of an object in an image along with the \
173 positions of each of its constituent parts.")
174 .def(py::init(&full_obj_det_init), py::arg("rect"), py::arg("parts"),
175"requires \n\
176 - rect: dlib rectangle \n\
177 - parts: list of dlib.point, or a dlib.points object.")
178 .def_property_readonly("rect", &full_obj_det_get_rect, "Bounding box from the underlying detector. Parts can be outside box if appropriate.")
179 .def_property_readonly("num_parts", &full_obj_det_num_parts, "The number of parts of the object.")
180 .def("part", &full_obj_det_part, py::arg("idx"), "A single part of the object as a dlib point.")
181 .def("parts", &full_obj_det_parts, "A vector of dlib points representing all of the parts.")
182 .def(py::pickle(&getstate<type>, &setstate<type>));
183 }
184 {
185 typedef shape_predictor_training_options type;
186 py::class_<type>(m, "shape_predictor_training_options",
187 "This object is a container for the options to the train_shape_predictor() routine.")
188 .def(py::init())
189 .def_readwrite("be_verbose", &type::be_verbose,
190 "If true, train_shape_predictor() will print out a lot of information to stdout while training.")
191 .def_readwrite("cascade_depth", &type::cascade_depth,
192 "The number of cascades created to train the model with.")
193 .def_readwrite("tree_depth", &type::tree_depth,
194 "The depth of the trees used in each cascade. There are pow(2, get_tree_depth()) leaves in each tree")
195 .def_readwrite("num_trees_per_cascade_level", &type::num_trees_per_cascade_level,
196 "The number of trees created for each cascade.")
197 .def_readwrite("nu", &type::nu,
198 "The regularization parameter. Larger values of this parameter \
199 will cause the algorithm to fit the training data better but may also \
200 cause overfitting. The value must be in the range (0, 1].")
201 .def_readwrite("oversampling_amount", &type::oversampling_amount,
202 "The number of randomly selected initial starting points sampled for each training example")
203 .def_readwrite("oversampling_translation_jitter", &type::oversampling_translation_jitter,
204 "The amount of translation jittering to apply to bounding boxes, a good value is in in the range [0 0.5].")
205 .def_readwrite("feature_pool_size", &type::feature_pool_size,
206 "Number of pixels used to generate features for the random trees.")
207 .def_readwrite("lambda_param", &type::lambda_param,
208 "Controls how tight the feature sampling should be. Lower values enforce closer features.")
209 .def_readwrite("num_test_splits", &type::num_test_splits,
210 "Number of split features at each node to sample. The one that gives the best split is chosen.")
211 .def_readwrite("landmark_relative_padding_mode", &type::landmark_relative_padding_mode,
212 "If True then features are drawn only from the box around the landmarks, otherwise they come from the bounding box and landmarks together. See feature_pool_region_padding doc for more details.")
213 .def_readwrite("feature_pool_region_padding", &type::feature_pool_region_padding,
214 /*!
215 This algorithm works by comparing the relative intensity of pairs of
216 pixels in the input image. To decide which pixels to look at, the
217 training algorithm randomly selects pixels from a box roughly centered
218 around the object of interest. We call this box the feature pool region
219 box.
220
221 Each object of interest is defined by a full_object_detection, which
222 contains a bounding box and a list of landmarks. If
223 landmark_relative_padding_mode==True then the feature pool region box is
224 the tightest box that contains the landmarks inside the

Callers 1

PYBIND11_MODULEFunction · 0.85

Calls 3

initFunction · 0.85
pickleFunction · 0.85
argClass · 0.50

Tested by

no test coverage detected