Open vinay0410 opened 5 years ago
Okay , will start working on it
i think we shall replace imp with "recorder" as this is the remaining value of enum imp with value equals to 0
Hi, @teamleader6 your solution will work but is a temporary fix, what if we have multiple values in enum, which are invalid.
I just had a look at the code of RecorderReader.h which isn't currently supported. It wasn't written by me, but after reading it I think we can support it. It is a simple code which reads some images from a path in rgb and depth format.
Using dummy rgb and depth images, see if RecorderReader works. I am changing this issue to add support for already written Recorder Reader if possible. This will also help you to get familiar with the codebase of DetectionSuite.
Feel free to comment below if you face any issues or have any questions.
RecorderReader.cpp is present here.
@vinay0410 i will work on it
RecorderReader.h:9:10: fatal error: Common/Sample.h: No such file or directory i searched but i didn't found sample.h i don't know is this related to version of c++ or not
It's present here, https://github.com/JdeRobot/dl-DetectionSuite/blob/master/DeepLearningSuite/DeepLearningSuiteLib/Common/Sample.h
RecorderReader.h isn't importing it correctly. Although you need not include it, since it's already present in #include "DatasetConverters/readers/DatasetReader.h"
which is included in RecorderReader.h
You may take hint from this file on how it's done https://github.com/JdeRobot/dl-DetectionSuite/blob/master/DeepLearningSuite/DeepLearningSuiteLib/DatasetConverters/liveReaders/CameraReader.h
test.cpp to support RecorderReader
int main()
{
const std::string colorImagePath = "/color_images/";
const std::string depthImagePath = "/depth_images/";
RecorderReader r(colorImagePath,depthImagePath);
//std::cout<<r.getNumSamples();
return 0;
}
g++ test.cpp pkg-config --cflags --libs opencv
i get 2 errors after tones of errors at beginning
/tmp/cc9i5xOM.o: In function main': test.cpp:(.text+0xad): undefined reference to
RecorderReader::RecorderReader(std::cxx11::basic_string<char, std::char_traits
after modifying those files modifying include to the right paths ,..etc
RecorderReader.cpp // // Created by frivas on 16/11/16. //
RecorderReader::RecorderReader(const std::string &colorImagesPath, const std::string &depthImagesPath):DatasetReader(true), colorPath(colorImagesPath), depthPath(depthImagesPath) { currentIndex=0; syncedData=false; getImagesByIndexes(depthPath,depthIndexes); getImagesByIndexes(colorPath,colorIndexes); }
RecorderReader::RecorderReader(const std::string &dataPath):DatasetReader(true), colorPath(dataPath), depthPath(dataPath) { currentIndex=0; syncedData=true; getImagesByIndexes(dataPath,depthIndexes,"-depth"); getImagesByIndexes(dataPath,colorIndexes,"-rgb"); }
void RecorderReader::getImagesByIndexes(const std::string& path, std::vector
boost::filesystem::directory_iterator end_iter;
for (boost::filesystem::directory_iterator dir_itr(path);
dir_itr != end_iter; dir_itr++) {
if (boost::filesystem::is_regular_file(*dir_itr) && dir_itr->path().extension() == ".png") {
std::string onlyIndexFilename;
if (not sufix.empty()) {
std::string filename=dir_itr->path().stem().string();
if ( ! boost::algorithm::ends_with(filename, sufix)){
continue;
}
onlyIndexFilename=dir_itr->path().filename().stem().string();
boost::erase_all(onlyIndexFilename,sufix);
}
else{
onlyIndexFilename=dir_itr->path().filename().stem().string();
}
LOG(INFO) << dir_itr->path().string() << std::endl;
LOG(INFO) << onlyIndexFilename << std::endl;
indexes.push_back(std::stoi(onlyIndexFilename));
}
}
}
if (indexes.empty()){
DLOG(WARNING) << "No images found in input sample path";
}
std::sort(indexes.begin(), indexes.end());
}
std::string RecorderReader::getPathByIndex(const std::string& path, int id,std::string sufix){ std::stringstream ss; ss << id << sufix << ".png"; std::string pathCompleted = PathHelper::concatPaths(path, ss.str()); return pathCompleted; }
int RecorderReader::closest(std::vector
return *it;
}
bool RecorderReader::getNextSample(Sample &sample) { if (this->currentIndex < this->depthIndexes.size()){ int indexValue = this->depthIndexes[currentIndex]; LOG(INFO)<<"Time stamp: " + std::to_string(indexValue);
cv::Mat colorImage= cv::imread(getPathByIndex(this->colorPath,closest(colorIndexes,indexValue),this->syncedData?"-rgb":""));
// if (!this->syncedData) cv::cvtColor(colorImage,colorImage,cv::COLOR_RGB2BGR);
sample.setColorImage(colorImage);
sample.setDepthImage(getPathByIndex(this->depthPath,indexValue,this->syncedData?"-depth":""));
this->currentIndex++;
return true;
}
return false;
}
int RecorderReader::getNumSamples() { return (int)this->depthIndexes.size(); }
RecorderReader::~RecorderReader(){
} RecorderReader.h // Created by frivas on 16/11/16. //
//#include <Common/Sample.h>
class RecorderReader: public DatasetReader { public: RecorderReader(const std::string& colorImagesPath, const std::string& depthImagesPath); explicit RecorderReader(const std::string& dataPath); bool getNextSample(Sample &sample) override; int getNumSamples(); ~RecorderReader(); // virtual bool getNextSample(Sample &sample);
private:
const std::string& depthPath;
const std::string& colorPath;
bool syncedData;
int currentIndex;
std::vector
void getImagesByIndexes(const std::string& path, std::vector<int>& indexes, std::string sufix="");
std::string getPathByIndex(const std::string& path,int id, std::string sufix="");
int closest(std::vector<int> const& vec, int value);
};
typedef boost::shared_ptr<RecorderReader> RecorderReaderPtr;
DatasetReader.h // // Created by frivas on 22/01/17. //
class DatasetReader {
public:
DatasetReader(const bool imagesRequired);
virtual bool getNextSample(Sample &sample);
virtual bool getNextSamples(std::vector
protected:
std::vector
typedef boost::shared_ptr
You are supposed to integrate this with DetectionSuite and then build using the steps mentioned
i solved another problem and the problem was in building and i builded well after modifications i did like you said i want ask how can i test RecorderReader now or just you want fixing errors and make pull request with final modifications in files
It is a simple code which reads some images from a path in rgb and depth format.
Using dummy rgb and depth images, see if RecorderReader works.
See this build log. You will see issues similar to:
This error is occurring because a variable of type enum is being appended to a string.