| 349 | } |
| 350 | |
| 351 | void ILSVRC::DecodeTransform(int flag, int thid, int nthreads, |
| 352 | vector<string *> images, Tensor *x, Tensor *y) { |
| 353 | int nimg = images.size(); |
| 354 | int start = nimg / nthreads * thid; |
| 355 | int end = start + nimg / nthreads; |
| 356 | for (int k = start; k < end; k++) { |
| 357 | std::vector<Tensor> pair = decoder->Decode(*images.at(k)); |
| 358 | auto tmp_image = pair[0] - mean; |
| 359 | Tensor aug_image = transformer->Apply(flag, tmp_image); |
| 360 | CopyDataToFrom(x, aug_image, aug_image.Size(), k * aug_image.Size()); |
| 361 | CopyDataToFrom(y, pair[1], 1, k); |
| 362 | } |
| 363 | if (thid == 0) { |
| 364 | for (int k = nimg / nthreads * nthreads; k < nimg; k++) { |
| 365 | std::vector<Tensor> pair = decoder->Decode(*images.at(k)); |
| 366 | auto tmp_image = pair[0] - mean; |
| 367 | Tensor aug_image = transformer->Apply(flag, tmp_image); |
| 368 | CopyDataToFrom(x, aug_image, aug_image.Size(), k * aug_image.Size()); |
| 369 | CopyDataToFrom(y, pair[1], 1, k); |
| 370 | } |
| 371 | } |
| 372 | } |
| 373 | } // namespace singa |
| 374 | |
| 375 | #endif // SINGA_EXAMPLES_IMAGENET_ILSVRC12_H_ |
nothing calls this directly
no test coverage detected