| 92 | } |
| 93 | |
| 94 | SegDataset::SegDataset(int resize_width, int resize_height, std::vector<std::string> list_images, |
| 95 | std::vector<std::string> list_labels, std::vector<std::string> name_list, |
| 96 | trainTricks tricks, bool isTrain) |
| 97 | { |
| 98 | this->tricks = tricks; |
| 99 | this->name_list = name_list; |
| 100 | this->resize_width = resize_width; |
| 101 | this->resize_height = resize_height; |
| 102 | this->list_images = list_images; |
| 103 | this->list_labels = list_labels; |
| 104 | this->isTrain = isTrain; |
| 105 | for(int i=0; i<name_list.size(); i++){ |
| 106 | name2index.insert(std::pair<std::string, int>(name_list[i], i)); |
| 107 | } |
| 108 | std::vector<cv::Scalar> color_list = get_color_list(); |
| 109 | if(name_list.size()>color_list.size()){ |
| 110 | std::cout<< "Num of classes exceeds defined color list, please add color to color list in SegDataset.cpp"; |
| 111 | } |
| 112 | for(int i = 0; i<name_list.size(); i++){ |
| 113 | name2color.insert(std::pair<std::string, cv::Scalar>(name_list[i],color_list[i])); |
| 114 | } |
| 115 | } |
| 116 | |
| 117 | torch::data::Example<> SegDataset::get(size_t index) { |
| 118 | std::string image_path = list_images.at(index); |
nothing calls this directly
no test coverage detected