mirror of https://github.com/davisking/dlib.git
Made the metric learning example do image jittering.
This commit is contained in:
parent
369f2b32e8
commit
1c664eeac5
|
@ -40,9 +40,8 @@ using namespace std;
|
||||||
// The dlib_face_recognition_resnet_model_v1 model used by this example was trained using
|
// 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
|
// 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
|
// 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
|
// was set to 10000, and the training dataset consisted of about 3 million images instead of
|
||||||
// dataset consisted of about 3 million images instead of 55. Also, the input layer was
|
// 55. Also, the input layer was locked to images of size 150.
|
||||||
// locked to images of size 150.
|
|
||||||
template <template <int,template<typename>class,int,typename> class block, int N, template<typename>class BN, typename SUBNET>
|
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>>>;
|
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
|
// You might want to do some data augmentation at this point. Here we do some simple
|
||||||
// color augmentation.
|
// color augmentation.
|
||||||
for (auto&& crop : images)
|
for (auto&& crop : images)
|
||||||
|
{
|
||||||
disturb_colors(crop,rnd);
|
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
|
// All the images going into a mini-batch have to be the same size. And really, all
|
||||||
|
|
Loading…
Reference in New Issue