diff --git a/README.md b/README.md index 11fe0c6..746a903 100644 --- a/README.md +++ b/README.md @@ -47,7 +47,7 @@ You should prepare your own data. You need two kinds of data, face with landmark .... ``` -bbox in `face.txt` indicate the face region. You can turn on data augment which will flip the face, but you also need to give symmetric landmarks index for flip operation. If bbox is out of range of the original image, the program will fill the rest region with black. +bbox in `face.txt` indicate the face region. You can turn on data augment which will flip the face, but you also need to give **symmetric landmarks index** for flip operation. If bbox is out of range of the original image, the program will fill the rest region with black. `background.txt` is much more simpler. Every line indicates where the background image in the file system. diff --git a/config.template.json b/config.template.json index a8db2dd..b07ebc1 100644 --- a/config.template.json +++ b/config.template.json @@ -49,7 +49,7 @@ } }, "face": { - "online_augment": true, + "online_augment": false, "symmetric_landmarks": { "offset": 1, "left": [1, 2, 5, 6, 7, 8, 9, 19, 22], diff --git a/src/jda/data.cpp b/src/jda/data.cpp index d67a1e7..373cc88 100644 --- a/src/jda/data.cpp +++ b/src/jda/data.cpp @@ -878,14 +878,14 @@ void NegGenerator::Load(const vector& path) { } fclose(file); - const int n = hd_list.size(); - hds.resize(2 * n); - int threads_n = omp_get_max_threads(); omp_set_num_threads(3 * threads_n); - cv::waitKey(1000); + SLEEP(1000); LOG("Load All Hard Negative Samples from text file"); + const int n = hd_list.size(); + hds.resize(n); + #pragma omp parallel for for (int i = 0; i < n; i++) { Mat img = cv::imread(hd_list[i], CV_LOAD_IMAGE_GRAYSCALE); @@ -894,21 +894,25 @@ void NegGenerator::Load(const vector& path) { continue; } cv::resize(img, img, Size(c.img_o_size, c.img_o_size)); - Mat img_flip; - cv::flip(img, img_flip, 1); hds[i] = img; - hds[i + n] = img_flip; } omp_set_num_threads(threads_n); SLEEP(1000); LOG("All hard negative samples Done"); + if (false) { + hds.resize(2 * n); + for (int i = 0; i < n; i++) { + if (hds[i].data) cv::flip(hds[i], hds[i + n], 1); + } + } + LOG("Snapshot hard negative"); FILE* data = fopen("../data/dump/hard.data", "wb"); - int n2 = 2 * n; + int n2 = hds.size(); fwrite(&n2, sizeof(int), 1, data); - for (int i = 0; i < hds.size(); i++) { + for (int i = 0; i < n2; i++) { Mat& img = hds[i]; if (!img.data) { int t4 = 0;