text
stringlengths 0
2.2M
|
---|
CHECK(u32text.is_truncated());
|
#endif
|
CHECK(Equal(std::string("Hello Worl"), ctext));
|
CHECK(Equal(std::wstring(L"Hello Worl"), ctext));
|
CHECK(Equal(std::u16string(u"Hello Worl"), ctext));
|
CHECK(Equal(std::u32string(U"Hello Worl"), ctext));
|
#endif
|
}
|
};
|
}
|
// Copyright (C) 2014 Davis E. King ([email protected])
|
// License: Boost Software License See LICENSE.txt for the full license.
|
#include "tester.h"
|
#include <dlib/image_processing/frontal_face_detector.h>
|
#include <dlib/image_processing.h>
|
#include <vector>
|
#include <sstream>
|
#include <dlib/compress_stream.h>
|
#include <dlib/base64.h>
|
#include <dlib/image_io.h>
|
//#include <dlib/gui_widgets.h>
|
//#include <dlib/image_processing/render_face_detections.h>
|
namespace
|
{
|
using namespace test;
|
using namespace dlib;
|
using namespace std;
|
dlib::logger dlog("test.face");
|
class face_tester : public tester
|
{
|
public:
|
face_tester (
|
) :
|
tester (
|
"test_face", // the command line argument name for this test
|
"Run tests on the face detection/landmarking modules.", // the command line argument description
|
0 // the number of command line arguments for this test
|
)
|
{
|
}
|
void get_test_face_landmark_dataset (
|
dlib::array<array2d<unsigned char> >& images,
|
std::vector<std::vector<full_object_detection> >& objects
|
)
|
{
|
istringstream sin(get_decoded_string());
|
images.resize(1);
|
objects.resize(1);
|
load_dng(images[0], sin);
|
pyramid_up(images[0]);
|
deserialize(objects[0], sin);
|
}
|
void perform_test()
|
{
|
print_spinner();
|
dlib::array<array2d<unsigned char> > images;
|
std::vector<std::vector<full_object_detection> > objects;
|
get_test_face_landmark_dataset(images, objects);
|
frontal_face_detector detector = get_frontal_face_detector();
|
print_spinner();
|
shape_predictor_trainer trainer;
|
trainer.set_tree_depth(2);
|
trainer.set_nu(0.05);
|
//trainer.be_verbose();
|
shape_predictor sp = trainer.train(images, objects);
|
print_spinner();
|
// It should have been able to perfectly fit the data
|
DLIB_TEST(test_shape_predictor(sp, images, objects) == 0);
|
print_spinner();
|
// While we are here, make sure the default face detector works
|
std::vector<rectangle> dets = detector(images[0]);
|
DLIB_TEST(dets.size() == 3);
|
/*
|
// visualize the detections
|
std::vector<full_object_detection> shapes;
|
for (unsigned long j = 0; j < dets.size(); ++j)
|
{
|
full_object_detection shape = sp(images[0], dets[j]);
|
shapes.push_back(shape);
|
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.