"examples/git@developer.sourcefind.cn:OpenDAS/dgl.git" did not exist on "672e3227190f54637ce6aa0d76c8c1162269781d"
Commit 2369ae1e authored by Davis King's avatar Davis King
Browse files

Made the python object detection tools process color images

in color instead of always converting to grayscale.
parent 849f3eb1
...@@ -46,7 +46,7 @@ options.add_left_right_image_flips = True ...@@ -46,7 +46,7 @@ options.add_left_right_image_flips = True
# empirically by checking how well the trained detector works on a test set of # empirically by checking how well the trained detector works on a test set of
# images you haven't trained on. Don't just leave the value set at 1. Try a # images you haven't trained on. Don't just leave the value set at 1. Try a
# few different C values and see what works best for your data. # few different C values and see what works best for your data.
options.C = 1 options.C = 5
# Tell the code how many CPU cores your computer has for the fastest training. # Tell the code how many CPU cores your computer has for the fastest training.
options.num_threads = 4 options.num_threads = 4
options.be_verbose = True options.be_verbose = True
......
...@@ -68,10 +68,10 @@ std::vector<rectangle> run_detector ( ...@@ -68,10 +68,10 @@ std::vector<rectangle> run_detector (
) )
{ {
pyramid_down<2> pyr; pyramid_down<2> pyr;
array2d<unsigned char> temp;
if (is_gray_python_image(img)) if (is_gray_python_image(img))
{ {
array2d<unsigned char> temp;
if (upsampling_amount == 0) if (upsampling_amount == 0)
{ {
return detector(numpy_gray_image(img)); return detector(numpy_gray_image(img));
...@@ -94,6 +94,7 @@ std::vector<rectangle> run_detector ( ...@@ -94,6 +94,7 @@ std::vector<rectangle> run_detector (
} }
else if (is_rgb_python_image(img)) else if (is_rgb_python_image(img))
{ {
array2d<rgb_pixel> temp;
if (upsampling_amount == 0) if (upsampling_amount == 0)
{ {
return detector(numpy_rgb_image(img)); return detector(numpy_rgb_image(img));
......
...@@ -127,7 +127,7 @@ namespace dlib ...@@ -127,7 +127,7 @@ namespace dlib
if (options.C <= 0) if (options.C <= 0)
throw error("Invalid C value given to train_simple_object_detector(), C must be > 0."); throw error("Invalid C value given to train_simple_object_detector(), C must be > 0.");
dlib::array<array2d<unsigned char> > images; dlib::array<array2d<rgb_pixel> > images;
std::vector<std::vector<rectangle> > boxes, ignore; std::vector<std::vector<rectangle> > boxes, ignore;
ignore = load_image_dataset(images, boxes, dataset_filename); ignore = load_image_dataset(images, boxes, dataset_filename);
...@@ -225,7 +225,7 @@ namespace dlib ...@@ -225,7 +225,7 @@ namespace dlib
const std::string& detector_filename const std::string& detector_filename
) )
{ {
dlib::array<array2d<unsigned char> > images; dlib::array<array2d<rgb_pixel> > images;
std::vector<std::vector<rectangle> > boxes, ignore; std::vector<std::vector<rectangle> > boxes, ignore;
ignore = load_image_dataset(images, boxes, dataset_filename); ignore = load_image_dataset(images, boxes, dataset_filename);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment