Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- case eClassifier:
- {
- TensorflowClassifier *c = static_cast<TensorflowClassifier*>(m_cnn);
- C2DTrackingsHistoryData* t = static_cast<C2DTrackingsHistoryData*>
- (current->dataSet()[IHistoryData::et2DTrackings].get());
- C2DTrackings tracks = t->get2DTrackings();
- std::cout << "!!!!name!!!! : " << m_cnn->getName() << " " << m_cnn->getInputHeight() << " " << m_cnn->getInputWidth() << std::endl;
- std::cout << "!!!!tracks!!!! : " << tracks.size() << std::endl;
- //std::vector<cv::Mat> class_imgs;
- cv::Mat cl_img;
- std::vector<int> classes_indices;
- for (const S2DTracking& tr: tracks) {
- if (tr.label != "Sign") {
- std::cout << "!!!!OUTPUT!!!! : " << tr.label << std::endl;
- continue;
- }
- const float x = tr.left * img.cols;
- const float y = tr.top * img.rows;
- const float w = tr.width * img.cols;
- const float h = tr.height * img.rows;
- cl_img = img(cv::Rect(x, y, w, h));
- c->inference({cl_img});
- classes_indices.push_back(c->getClassesOutputAsIndices()[0]);
- //class_imgs.push_back(cl_img);
- }
- // if(!class_imgs.size()) {
- // return true;
- // }
- //c->inference(class_imgs);
- if (!c) {
- LOG_ERROR("Empty classification model");
- return false;
- }
- //auto classes_indices = c->getClassesOutputAsIndices();
- // if (classes_indices.empty()) {
- // LOG_ERROR("Empty results");
- // return false;
- // }
- auto labels = c->getLabelNames();
- for (auto l: classes_indices) {
- std::cout << "!!!!OUTPUT!!!! : " << c->getLabelNames()[l] << std::endl;
- }
- current->dataSet()[IHistoryData::etClassificationData] =
- IHistoryDataPtr(new ClassificationHistoryData(classes_indices, labels));
- } break;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement