| 579 | |
| 580 | template<typename Dtype> |
| 581 | void DataTransformer<Dtype>::ReadMetaData(MetaData& meta, const string& data, size_t offset3, size_t offset1) { //very specific to genLMDB.py |
| 582 | // ------------------- Dataset name ---------------------- |
| 583 | meta.dataset = DecodeString(data, offset3); |
| 584 | // ------------------- Image Dimension ------------------- |
| 585 | float height, width; |
| 586 | DecodeFloats(data, offset3+offset1, &height, 1); |
| 587 | DecodeFloats(data, offset3+offset1+4, &width, 1); |
| 588 | meta.img_size = cv::Size(width, height); |
| 589 | // ----------- Validation, nop, counters ----------------- |
| 590 | meta.isValidation = (data[offset3+2*offset1]==0 ? false : true); |
| 591 | meta.numOtherPeople = (int)data[offset3+2*offset1+1]; |
| 592 | meta.people_index = (int)data[offset3+2*offset1+2]; |
| 593 | float annolist_index; |
| 594 | DecodeFloats(data, offset3+2*offset1+3, &annolist_index, 1); |
| 595 | meta.annolist_index = (int)annolist_index; |
| 596 | float write_number; |
| 597 | DecodeFloats(data, offset3+2*offset1+7, &write_number, 1); |
| 598 | meta.write_number = (int)write_number; |
| 599 | float total_write_number; |
| 600 | DecodeFloats(data, offset3+2*offset1+11, &total_write_number, 1); |
| 601 | meta.total_write_number = (int)total_write_number; |
| 602 | |
| 603 | // count epochs according to counters |
| 604 | static int cur_epoch = -1; |
| 605 | if(meta.write_number == 0){ |
| 606 | cur_epoch++; |
| 607 | } |
| 608 | meta.epoch = cur_epoch; |
| 609 | if(meta.write_number % 1000 == 0){ |
| 610 | LOG(INFO) << "dataset: " << meta.dataset <<"; img_size: " << meta.img_size |
| 611 | << "; meta.annolist_index: " << meta.annolist_index << "; meta.write_number: " << meta.write_number |
| 612 | << "; meta.total_write_number: " << meta.total_write_number << "; meta.epoch: " << meta.epoch; |
| 613 | } |
| 614 | //LOG(INFO) << "np_in_lmdb" << np_in_lmdb; |
| 615 | if(param_.aug_way() == "table" && !is_table_set){ |
| 616 | SetAugTable(meta.total_write_number); |
| 617 | is_table_set = true; |
| 618 | } |
| 619 | |
| 620 | // ------------------- objpos ----------------------- |
| 621 | DecodeFloats(data, offset3+3*offset1, &meta.objpos.x, 1); |
| 622 | DecodeFloats(data, offset3+3*offset1+4, &meta.objpos.y, 1); |
| 623 | meta.objpos -= cv::Point2f(1,1); |
| 624 | // ------------ scale_self, joint_self -------------- |
| 625 | DecodeFloats(data, offset3+4*offset1, &meta.scale_self, 1); |
| 626 | meta.joint_self.joints.resize(np_in_lmdb); |
| 627 | meta.joint_self.isVisible.resize(np_in_lmdb); |
| 628 | for(int i=0; i<np_in_lmdb; i++){ |
| 629 | DecodeFloats(data, offset3+5*offset1+4*i, &meta.joint_self.joints[i].x, 1); |
| 630 | DecodeFloats(data, offset3+6*offset1+4*i, &meta.joint_self.joints[i].y, 1); |
| 631 | meta.joint_self.joints[i] -= cv::Point2f(1,1); //from matlab 1-index to c++ 0-index |
| 632 | float isVisible; |
| 633 | DecodeFloats(data, offset3+7*offset1+4*i, &isVisible, 1); |
| 634 | if (isVisible == 3){ |
| 635 | meta.joint_self.isVisible[i] = 3; |
| 636 | } |
| 637 | else{ |
| 638 | meta.joint_self.isVisible[i] = (isVisible == 0) ? 0 : 1; |
nothing calls this directly
no test coverage detected