#include #include #include #include #include #include #include #include #ifdef _WIN32 #include #include #include #else #include #include #include #include #endif #include namespace migraphxSamples { _Time GetCurrentTime3() { _Time currentTime; #if (defined WIN32 || defined _WIN32) SYSTEMTIME systemTime; GetLocalTime(&systemTime); char temp[8] = { 0 }; sprintf(temp, "%04d", systemTime.wYear); currentTime.year=string(temp); sprintf(temp, "%02d", systemTime.wMonth); currentTime.month=string(temp); sprintf(temp, "%02d", systemTime.wDay); currentTime.day=string(temp); sprintf(temp, "%02d", systemTime.wHour); currentTime.hour=string(temp); sprintf(temp, "%02d", systemTime.wMinute); currentTime.minute=string(temp); sprintf(temp, "%02d", systemTime.wSecond); currentTime.second=string(temp); sprintf(temp, "%03d", systemTime.wMilliseconds); currentTime.millisecond=string(temp); sprintf(temp, "%d", systemTime.wDayOfWeek); currentTime.weekDay=string(temp); #else struct timeval tv; struct tm *p; gettimeofday(&tv, NULL); p = localtime(&tv.tv_sec); char temp[8]={0}; sprintf(temp,"%04d",1900+p->tm_year); currentTime.year=string(temp); sprintf(temp,"%02d",1+p->tm_mon); currentTime.month=string(temp); sprintf(temp,"%02d",p->tm_mday); currentTime.day=string(temp); sprintf(temp,"%02d",p->tm_hour); currentTime.hour=string(temp); sprintf(temp,"%02d",p->tm_min); currentTime.minute=string(temp); sprintf(temp,"%02d",p->tm_sec); currentTime.second=string(temp); sprintf(temp,"%03d",tv.tv_usec/1000); currentTime.millisecond = string(temp); sprintf(temp, "%03d", tv.tv_usec % 1000); currentTime.microsecond = string(temp); sprintf(temp, "%d", p->tm_wday); currentTime.weekDay = string(temp); #endif return currentTime; } std::vector SplitString(std::string str, std::string separator) { std::string::size_type pos; std::vector result; str+=separator;//扩展字符串以方便操作 int size=str.size(); for(int i=0; i R.confidence; } bool CompareArea(const ResultOfDetection &L,const ResultOfDetection &R) { return L.boundingBox.area() > R.boundingBox.area(); } void NMS(vector &detections, float IOUThreshold) { // sort std::sort(detections.begin(), detections.end(), CompareConfidence); for (int i = 0; iIOUThreshold) { detections[j].exist = false; } } } } } } }