Commit 1c664eea authored by Davis King's avatar Davis King

Made the metric learning example do image jittering.

parent 369f2b32
......@@ -40,9 +40,8 @@ using namespace std;
// The dlib_face_recognition_resnet_model_v1 model used by this example was trained using
// essentially the code shown in dnn_metric_learning_on_images_ex.cpp except the
// mini-batches were made larger (35x15 instead of 5x5), the iterations without progress
// was set to 10000, dlib::jitter_image() was used during training, and the training
// dataset consisted of about 3 million images instead of 55. Also, the input layer was
// locked to images of size 150.
// was set to 10000, and the training dataset consisted of about 3 million images instead of
// 55. Also, the input layer was locked to images of size 150.
template <template <int,template<typename>class,int,typename> class block, int N, template<typename>class BN, typename SUBNET>
using residual = add_prev1<block<N,BN,1,tag1<SUBNET>>>;
......
......@@ -116,7 +116,12 @@ void load_mini_batch (
// You might want to do some data augmentation at this point. Here we do some simple
// color augmentation.
for (auto&& crop : images)
{
disturb_colors(crop,rnd);
// Jitter most crops
if (rnd.get_random_double() > 0.1)
crop = jitter_image(crop,rnd);
}
// All the images going into a mini-batch have to be the same size. And really, all
......
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