#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include BOOST_GEOMETRY_REGISTER_C_ARRAY_CS(cs::cartesian) typedef boost::geometry::model::polygon > Polygon; using namespace std; /*======================================================================= STATIC EVALUATION PARAMETERS =======================================================================*/ // holds the number of test images on the server //const int32_t N_TESTIMAGES = 7518; int32_t N_TESTIMAGES = 7480; // Validation const int32_t append_zeros = 6; // easy, moderate and hard evaluation level enum DIFFICULTY{EASY=0, MODERATE=1, HARD=2}; // evaluation metrics: image, ground or 3D enum METRIC{IMAGE=0, GROUND=1, BOX3D=2}; // evaluation parameter const int32_t MIN_HEIGHT[3] = {40, 25, 25}; // minimum height for evaluated groundtruth/detections const int32_t MAX_OCCLUSION[3] = {0, 1, 2}; // maximum occlusion level of the groundtruth used for evaluation const double MAX_TRUNCATION[3] = {0.15, 0.3, 0.5}; // maximum truncation level of the groundtruth used for evaluation // evaluated object classes enum CLASSES{CAR=0, PEDESTRIAN=1, CYCLIST=2}; const int NUM_CLASS = 3; // parameters varying per class vector CLASS_NAMES; vector CLASS_NAMES_CAP; // the minimum overlap required for 2D evaluation on the image/ground plane and 3D evaluation const double MIN_OVERLAP[3][3] = {{0.7, 0.5, 0.5}, {0.7, 0.5, 0.5}, {0.7, 0.5, 0.5}}; //const double MIN_OVERLAP[3][3] = {{0.1, 0.1, 0.1}, {0.1, 0.1, 0.1}, {0.1, 0.1, 0.1}}; // no. of recall steps that should be evaluated (discretized) const double N_SAMPLE_PTS = 41; // initialize class names void initGlobals () { CLASS_NAMES.push_back("car"); CLASS_NAMES.push_back("pedestrian"); CLASS_NAMES.push_back("cyclist"); CLASS_NAMES_CAP.push_back("Car"); CLASS_NAMES_CAP.push_back("Pedestrian"); CLASS_NAMES_CAP.push_back("Cyclist"); } /*======================================================================= DATA TYPES FOR EVALUATION =======================================================================*/ // holding data needed for precision-recall and precision-aos struct tPrData { vector v; // detection score for computing score thresholds double similarity; // orientation similarity int32_t tp; // true positives int32_t fp; // false positives int32_t fn; // false negatives tPrData () : similarity(0), tp(0), fp(0), fn(0) {} }; // holding bounding boxes for ground truth and detections struct tBox { string type; // object type as car, pedestrian or cyclist,... double x1; // left corner double y1; // top corner double x2; // right corner double y2; // bottom corner double alpha; // image orientation tBox (string type, double x1,double y1,double x2,double y2,double alpha) : type(type),x1(x1),y1(y1),x2(x2),y2(y2),alpha(alpha) {} }; // holding ground truth data struct tGroundtruth { tBox box; // object type, box, orientation double truncation; // truncation 0..1 int32_t occlusion; // occlusion 0,1,2 (non, partly, fully) double ry; double t1, t2, t3; double h, w, l; tGroundtruth () : box(tBox("invalild",-1,-1,-1,-1,-10)),truncation(-1),occlusion(-1) {} tGroundtruth (tBox box,double truncation,int32_t occlusion) : box(box),truncation(truncation),occlusion(occlusion) {} tGroundtruth (string type,double x1,double y1,double x2,double y2,double alpha,double truncation,int32_t occlusion) : box(tBox(type,x1,y1,x2,y2,alpha)),truncation(truncation),occlusion(occlusion) {} }; // holding detection data struct tDetection { tBox box; // object type, box, orientation double thresh; // detection score double ry; double t1, t2, t3; double h, w, l; tDetection (): box(tBox("invalid",-1,-1,-1,-1,-10)),thresh(-1000) {} tDetection (tBox box,double thresh) : box(box),thresh(thresh) {} tDetection (string type,double x1,double y1,double x2,double y2,double alpha,double thresh) : box(tBox(type,x1,y1,x2,y2,alpha)),thresh(thresh) {} }; /*======================================================================= FUNCTIONS TO LOAD DETECTION AND GROUND TRUTH DATA ONCE, SAVE RESULTS =======================================================================*/ vector loadDetections(string file_name, bool &compute_aos, vector &eval_image, vector &eval_ground, vector &eval_3d, bool &success) { // holds all detections (ignored detections are indicated by an index vector vector detections; FILE *fp = fopen(file_name.c_str(),"r"); if (!fp) { success = false; return detections; } while (!feof(fp)) { tDetection d; double trash; char str[255]; if (fscanf(fp, "%s %lf %lf %lf %lf %lf %lf %lf %lf %lf %lf %lf %lf %lf %lf %lf", str, &trash, &trash, &d.box.alpha, &d.box.x1, &d.box.y1, &d.box.x2, &d.box.y2, &d.h, &d.w, &d.l, &d.t1, &d.t2, &d.t3, &d.ry, &d.thresh)==16) { // d.thresh = 1; d.box.type = str; detections.push_back(d); // orientation=-10 is invalid, AOS is not evaluated if at least one orientation is invalid if(d.box.alpha == -10) compute_aos = false; // a class is only evaluated if it is detected at least once for (int c = 0; c < NUM_CLASS; c++) { if (!strcasecmp(d.box.type.c_str(), CLASS_NAMES[c].c_str()) || !strcasecmp(d.box.type.c_str(), CLASS_NAMES_CAP[c].c_str())) { if (!eval_image[c] && d.box.x1 >= 0) eval_image[c] = true; if (!eval_ground[c] && d.t1 != -1000 && d.t3 != -1000 && d.w > 0 && d.l > 0) eval_ground[c] = true; if (!eval_3d[c] && d.t1 != -1000 && d.t2 != -1000 && d.t3 != -1000 && d.h > 0 && d.w > 0 && d.l > 0) eval_3d[c] = true; break; } } } } fclose(fp); success = true; return detections; } vector loadGroundtruth(string file_name,bool &success) { // holds all ground truth (ignored ground truth is indicated by an index vector vector groundtruth; FILE *fp = fopen(file_name.c_str(),"r"); if (!fp) { success = false; return groundtruth; } while (!feof(fp)) { tGroundtruth g; char str[255]; if (fscanf(fp, "%s %lf %d %lf %lf %lf %lf %lf %lf %lf %lf %lf %lf %lf %lf", str, &g.truncation, &g.occlusion, &g.box.alpha, &g.box.x1, &g.box.y1, &g.box.x2, &g.box.y2, &g.h, &g.w, &g.l, &g.t1, &g.t2, &g.t3, &g.ry )==15) { g.box.type = str; groundtruth.push_back(g); } } fclose(fp); success = true; return groundtruth; } void saveStats (const vector &precision, const vector &aos, FILE *fp_det, FILE *fp_ori) { // save precision to file if(precision.empty()) return; for (int32_t i=0; i Polygon toPolygon(const T& g) { using namespace boost::numeric::ublas; using namespace boost::geometry; matrix mref(2, 2); mref(0, 0) = cos(g.ry); mref(0, 1) = sin(g.ry); mref(1, 0) = -sin(g.ry); mref(1, 1) = cos(g.ry); static int count = 0; matrix corners(2, 4); double data[] = {g.l / 2, g.l / 2, -g.l / 2, -g.l / 2, g.w / 2, -g.w / 2, -g.w / 2, g.w / 2}; std::copy(data, data + 8, corners.data().begin()); matrix gc = prod(mref, corners); for (int i = 0; i < 4; ++i) { gc(0, i) += g.t1; gc(1, i) += g.t3; } double points[][2] = {{gc(0, 0), gc(1, 0)},{gc(0, 1), gc(1, 1)},{gc(0, 2), gc(1, 2)},{gc(0, 3), gc(1, 3)},{gc(0, 0), gc(1, 0)}}; Polygon poly; append(poly, points); return poly; } // measure overlap between bird's eye view bounding boxes, parametrized by (ry, l, w, tx, tz) inline double groundBoxOverlap(tDetection d, tGroundtruth g, int32_t criterion = -1) { using namespace boost::geometry; Polygon gp = toPolygon(g); Polygon dp = toPolygon(d); std::vector in, un; intersection(gp, dp, in); union_(gp, dp, un); double inter_area = in.empty() ? 0 : area(in.front()); double union_area = area(un.front()); double o; if(criterion==-1) // union o = inter_area / union_area; else if(criterion==0) // bbox_a o = inter_area / area(dp); else if(criterion==1) // bbox_b o = inter_area / area(gp); return o; } // measure overlap between 3D bounding boxes, parametrized by (ry, h, w, l, tx, ty, tz) inline double box3DOverlap(tDetection d, tGroundtruth g, int32_t criterion = -1) { using namespace boost::geometry; Polygon gp = toPolygon(g); Polygon dp = toPolygon(d); std::vector in, un; intersection(gp, dp, in); union_(gp, dp, un); double ymax = min(d.t2, g.t2); double ymin = max(d.t2 - d.h, g.t2 - g.h); double inter_area = in.empty() ? 0 : area(in.front()); double inter_vol = inter_area * max(0.0, ymax - ymin); double det_vol = d.h * d.l * d.w; double gt_vol = g.h * g.l * g.w; double o; if(criterion==-1) // union o = inter_vol / (det_vol + gt_vol - inter_vol); else if(criterion==0) // bbox_a o = inter_vol / det_vol; else if(criterion==1) // bbox_b o = inter_vol / gt_vol; return o; } vector getThresholds(vector &v, double n_groundtruth){ // holds scores needed to compute N_SAMPLE_PTS recall values vector t; // sort scores in descending order // (highest score is assumed to give best/most confident detections) sort(v.begin(), v.end(), greater()); // get scores for linearly spaced recall double current_recall = 0; for(int32_t i=0; i >, const vector &det, vector &ignored_gt, vector &dc, vector &ignored_det, int32_t &n_gt, DIFFICULTY difficulty){ // extract ground truth bounding boxes for current evaluation class for(int32_t i=0;iMAX_OCCLUSION[difficulty] || gt[i].truncation>MAX_TRUNCATION[difficulty] || height<=MIN_HEIGHT[difficulty]) ignore = true; // set ignored vector for ground truth // current class and not ignored (total no. of ground truth is detected for recall denominator) if(valid_class==1 && !ignore){ ignored_gt.push_back(0); n_gt++; } // neighboring class, or current class but ignored else if(valid_class==0 || (ignore && valid_class==1)) ignored_gt.push_back(1); // all other classes which are FN in the evaluation else ignored_gt.push_back(-1); } // extract dontcare areas for(int32_t i=0;i >, const vector &det, const vector &dc, const vector &ignored_gt, const vector &ignored_det, bool compute_fp, double (*boxoverlap)(tDetection, tGroundtruth, int32_t), METRIC metric, bool compute_aos=false, double thresh=0, bool debug=false){ tPrData stat = tPrData(); const double NO_DETECTION = -10000000; vector delta; // holds angular difference for TPs (needed for AOS evaluation) vector assigned_detection; // holds wether a detection was assigned to a valid or ignored ground truth assigned_detection.assign(det.size(), false); vector ignored_threshold; ignored_threshold.assign(det.size(), false); // holds detections with a threshold lower than thresh if FP are computed // detections with a low score are ignored for computing precision (needs FP) if(compute_fp) for(int32_t i=0; i 0.5) (logical len(det)) =======================================================================*/ int32_t det_idx = -1; double valid_detection = NO_DETECTION; double max_overlap = 0; // search for a possible detection bool assigned_ignored_det = false; for(int32_t j=0; jMIN_OVERLAP[metric][current_class] && det[j].thresh>valid_detection){ det_idx = j; valid_detection = det[j].thresh; } // for computing pr curve values, the candidate with the greatest overlap is considered // if the greatest overlap is an ignored detection (min_height), the overlapping detection is used else if(compute_fp && overlap>MIN_OVERLAP[metric][current_class] && (overlap>max_overlap || assigned_ignored_det) && ignored_det[j]==0){ max_overlap = overlap; det_idx = j; valid_detection = 1; assigned_ignored_det = false; } else if(compute_fp && overlap>MIN_OVERLAP[metric][current_class] && valid_detection==NO_DETECTION && ignored_det[j]==1){ det_idx = j; valid_detection = 1; assigned_ignored_det = true; } } /*======================================================================= compute TP, FP and FN =======================================================================*/ // nothing was assigned to this valid ground truth if(valid_detection==NO_DETECTION && ignored_gt[i]==0) { stat.fn++; } // only evaluate valid ground truth <=> detection assignments (considering difficulty level) else if(valid_detection!=NO_DETECTION && (ignored_gt[i]==1 || ignored_det[det_idx]==1)) assigned_detection[det_idx] = true; // found a valid true positive else if(valid_detection!=NO_DETECTION){ // write highest score to threshold vector stat.tp++; stat.v.push_back(det[det_idx].thresh); // compute angular difference of detection and ground truth if valid detection orientation was provided if(compute_aos) delta.push_back(gt[i].box.alpha - det[det_idx].box.alpha); // clean up assigned_detection[det_idx] = true; } } // if FP are requested, consider stuff area if(compute_fp){ // count fp for(int32_t i=0; iMIN_OVERLAP[metric][current_class]){ assigned_detection[j] = true; nstuff++; } } } // FP = no. of all not to ground truth assigned detections - detections assigned to stuff areas stat.fp -= nstuff; // if all orientation values are valid, the AOS is computed if(compute_aos){ vector tmp; // FP have a similarity of 0, for all TP compute AOS tmp.assign(stat.fp, 0); for(int32_t i=0; i0 || stat.fp>0) stat.similarity = accumulate(tmp.begin(), tmp.end(), 0.0); // there was neither a FP nor a TP, so the similarity is ignored in the evaluation else stat.similarity = -1; } } return stat; } /*======================================================================= EVALUATE CLASS-WISE =======================================================================*/ bool eval_class (FILE *fp_det, FILE *fp_ori, CLASSES current_class, const vector< vector > &groundtruth, const vector< vector > &detections, bool compute_aos, double (*boxoverlap)(tDetection, tGroundtruth, int32_t), vector &precision, vector &aos, DIFFICULTY difficulty, METRIC metric) { assert(groundtruth.size() == detections.size()); // init int32_t n_gt=0; // total no. of gt (denominator of recall) vector v, thresholds; // detection scores, evaluated for recall discretization vector< vector > ignored_gt, ignored_det; // index of ignored gt detection for current class/difficulty vector< vector > dontcare; // index of dontcare areas, included in ground truth // for all test images do for (int32_t i=0; i i_gt, i_det; vector dc; // only evaluate objects of current class and ignore occluded, truncated objects cleanData(current_class, groundtruth[i], detections[i], i_gt, dc, i_det, n_gt, difficulty); ignored_gt.push_back(i_gt); ignored_det.push_back(i_det); dontcare.push_back(dc); // compute statistics to get recall values tPrData pr_tmp = tPrData(); pr_tmp = computeStatistics(current_class, groundtruth[i], detections[i], dc, i_gt, i_det, false, boxoverlap, metric); // add detection scores to vector over all images for(int32_t j=0; j pr; pr.assign(thresholds.size(),tPrData()); for (int32_t i=0; i recall; precision.assign(N_SAMPLE_PTS, 0); if(compute_aos) aos.assign(N_SAMPLE_PTS, 0); double r=0; for (int32_t i=0; i vals[],bool is_aos){ char command[1024]; // save plot data to file FILE *fp = fopen((dir_name + "/" + file_name + ".txt").c_str(),"w"); printf("save %s\n", (dir_name + "/" + file_name + ".txt").c_str()); for (int32_t i=0; i<(int)N_SAMPLE_PTS; i++) fprintf(fp,"%f %f %f %f\n",(double)i/(N_SAMPLE_PTS-1.0),vals[0][i],vals[1][i],vals[2][i]); fclose(fp); // create png + eps for (int32_t j=0; j<2; j++) { // open file FILE *fp = fopen((dir_name + "/" + file_name + ".gp").c_str(),"w"); // save gnuplot instructions if (j==0) { fprintf(fp,"set term png size 450,315 font \"Helvetica\" 11\n"); fprintf(fp,"set output \"%s.png\"\n",file_name.c_str()); } else { fprintf(fp,"set term postscript eps enhanced color font \"Helvetica\" 20\n"); fprintf(fp,"set output \"%s.eps\"\n",file_name.c_str()); } // set labels and ranges fprintf(fp,"set size ratio 0.7\n"); fprintf(fp,"set xrange [0:1]\n"); fprintf(fp,"set yrange [0:1]\n"); fprintf(fp,"set xlabel \"Recall\"\n"); if (!is_aos) fprintf(fp,"set ylabel \"Precision\"\n"); else fprintf(fp,"set ylabel \"Orientation Similarity\"\n"); obj_type[0] = toupper(obj_type[0]); fprintf(fp,"set title \"%s\"\n",obj_type.c_str()); // line width int32_t lw = 5; if (j==0) lw = 3; // plot error curve fprintf(fp,"plot "); fprintf(fp,"\"%s.txt\" using 1:2 title 'Easy' with lines ls 1 lw %d,",file_name.c_str(),lw); fprintf(fp,"\"%s.txt\" using 1:3 title 'Moderate' with lines ls 2 lw %d,",file_name.c_str(),lw); fprintf(fp,"\"%s.txt\" using 1:4 title 'Hard' with lines ls 3 lw %d",file_name.c_str(),lw); // close file fclose(fp); // run gnuplot => create png + eps sprintf(command,"cd %s; gnuplot %s",dir_name.c_str(),(file_name + ".gp").c_str()); system(command); } // create pdf and crop sprintf(command,"cd %s; ps2pdf %s.eps %s_large.pdf",dir_name.c_str(),file_name.c_str(),file_name.c_str()); system(command); sprintf(command,"cd %s; pdfcrop %s_large.pdf %s.pdf",dir_name.c_str(),file_name.c_str(),file_name.c_str()); system(command); sprintf(command,"cd %s; rm %s_large.pdf",dir_name.c_str(),file_name.c_str()); system(command); } bool eval(string result_sha,string input_dataset){ // set some global parameters initGlobals(); // ground truth and result directories string gt_dir = "data/object/label_2"; string result_dir = "results/" + result_sha; string plot_dir = result_dir + "/plot"; string valid_imgs_path = "lists/" + input_dataset + ".txt"; std::cout << "Results list: " << valid_imgs_path << std::endl; // create output directories system(("mkdir " + plot_dir).c_str()); // hold detections and ground truth in memory vector< vector > groundtruth; vector< vector > detections; // holds wether orientation similarity shall be computed (might be set to false while loading detections) // and which labels where provided by this submission bool compute_aos=true; vector eval_image(NUM_CLASS, false); vector eval_ground(NUM_CLASS, false); vector eval_3d(NUM_CLASS, false); /* LB load only validation images */ std::cout << "Getting valid images... " << std::endl; // Get image indices ifstream valid_imgs(valid_imgs_path.c_str()); if (!valid_imgs.is_open()){ std::cout << valid_imgs_path << " not found" << std::endl; exit(-1); } string line; vector indices; while (!valid_imgs.eof()) { getline (valid_imgs,line); if (atoi(line.c_str())!=0){ indices.push_back(atoi(line.c_str())); } } std::cout << "Validation file loaded" << std::endl; N_TESTIMAGES = indices.size(); std::cout << indices.size() << std::endl; // Just to get stats for each class vector count, count_gt; count.assign(CLASS_NAMES.size(), 0); count_gt.assign(CLASS_NAMES.size(), 0); // for all images read groundtruth and detections std::cout << "Loading detections... " << std::endl; for (int32_t i=0; i gt = loadGroundtruth(gt_dir + "/" + file_name,gt_success); vector det = loadDetections(result_dir + "/data/" + file_name, compute_aos, eval_image, eval_ground, eval_3d, det_success); groundtruth.push_back(gt); detections.push_back(det); // check for errors if (!gt_success) { std::cout << "ERROR: Couldn't read: " << gt_dir + "/" + file_name << " of ground truth." << std::endl;; return false; } if (!det_success) { std::cout << "ERROR: Couldn't read: " << result_dir + "/data/" + file_name <msg("Checking 2D evaluation (%s) ...", CLASS_NAMES[c].c_str()); if (eval_image[c]) { cout << "Starting 2D evaluation (" << CLASS_NAMES[c] << ") ..." << endl; fp_det = fopen((result_dir + "/stats_" + CLASS_NAMES[c] + "_detection.txt").c_str(), "w"); if(compute_aos) fp_ori = fopen((result_dir + "/stats_" + CLASS_NAMES[c] + "_orientation.txt").c_str(),"w"); vector precision[3], aos[3]; if( !eval_class(fp_det, fp_ori, cls, groundtruth, detections, compute_aos, imageBoxOverlap, precision[0], aos[0], EASY, IMAGE) || !eval_class(fp_det, fp_ori, cls, groundtruth, detections, compute_aos, imageBoxOverlap, precision[1], aos[1], MODERATE, IMAGE) || !eval_class(fp_det, fp_ori, cls, groundtruth, detections, compute_aos, imageBoxOverlap, precision[2], aos[2], HARD, IMAGE)) { cout << CLASS_NAMES[c].c_str() << " evaluation failed." << endl; return false; } fclose(fp_det); saveAndPlotPlots(plot_dir, CLASS_NAMES[c] + "_detection", CLASS_NAMES[c], precision, 0); if(compute_aos){ saveAndPlotPlots(plot_dir, CLASS_NAMES[c] + "_orientation", CLASS_NAMES[c], aos, 1); fclose(fp_ori); } cout << " done." << endl; } } // don't evaluate AOS for birdview boxes and 3D boxes compute_aos = false; // eval bird's eye view bounding boxes for (int c = 0; c < NUM_CLASS; c++) { CLASSES cls = (CLASSES)c; //mail->msg("Checking bird's eye evaluation (%s) ...", CLASS_NAMES[c].c_str()); if (eval_ground[c]) { cout << "Starting bird's eye evaluation (" << CLASS_NAMES[c] << ") ..."; fp_det = fopen((result_dir + "/stats_" + CLASS_NAMES[c] + "_detection_ground.txt").c_str(), "w"); vector precision[3], aos[3]; if( !eval_class(fp_det, fp_ori, cls, groundtruth, detections, compute_aos, groundBoxOverlap, precision[0], aos[0], EASY, GROUND) || !eval_class(fp_det, fp_ori, cls, groundtruth, detections, compute_aos, groundBoxOverlap, precision[1], aos[1], MODERATE, GROUND) || !eval_class(fp_det, fp_ori, cls, groundtruth, detections, compute_aos, groundBoxOverlap, precision[2], aos[2], HARD, GROUND)) { cout << CLASS_NAMES[c].c_str() << " evaluation failed." << endl; return false; } fclose(fp_det); saveAndPlotPlots(plot_dir, CLASS_NAMES[c] + "_detection_ground", CLASS_NAMES[c], precision, 0); cout << " done." << endl; } } // eval 3D bounding boxes for (int c = 0; c < NUM_CLASS; c++) { CLASSES cls = (CLASSES)c; //mail->msg("Checking 3D evaluation (%s) ...", CLASS_NAMES[c].c_str()); if (eval_3d[c]) { cout << "Starting 3D evaluation (" << CLASS_NAMES[c] << ") ..." << endl; fp_det = fopen((result_dir + "/stats_" + CLASS_NAMES[c] + "_detection_3d.txt").c_str(), "w"); vector precision[3], aos[3]; if( !eval_class(fp_det, fp_ori, cls, groundtruth, detections, compute_aos, box3DOverlap, precision[0], aos[0], EASY, BOX3D) || !eval_class(fp_det, fp_ori, cls, groundtruth, detections, compute_aos, box3DOverlap, precision[1], aos[1], MODERATE, BOX3D) || !eval_class(fp_det, fp_ori, cls, groundtruth, detections, compute_aos, box3DOverlap, precision[2], aos[2], HARD, BOX3D)) { cout << CLASS_NAMES[c].c_str() << " evaluation failed." << endl; return false; } fclose(fp_det); saveAndPlotPlots(plot_dir, CLASS_NAMES[c] + "_detection_3d", CLASS_NAMES[c], precision, 0); cout << " done." << endl; } } // success return true; } int32_t main (int32_t argc,char *argv[]) { // we need 2 or 4 arguments! if (argc!=3) { cout << "Usage: ./eval_detection result_sha val_dataset" << endl; return 1; } // read arguments string result_sha = argv[1]; string input_dataset = argv[2]; std:cout << "Starting evaluation..." << std::endl; // run evaluation if(eval(result_sha,input_dataset)){ cout << "Evaluation finished successfully" << endl; }else{ cout << "Something happened..." << endl; }; return 0; } //Original //int32_t main (int32_t argc,char *argv[]) { // // // we need 2 or 4 arguments! // if (argc!=2 && argc!=4) { // cout << "Usage: ./eval_detection result_sha [user_sha email]" << endl; // return 1; // } // // // read arguments // string result_sha = argv[1]; // // // init notification mail // Mail *mail; // if (argc==4) mail = new Mail(argv[3]); // else mail = new Mail(); // mail->msg("Thank you for participating in our evaluation!"); // // // run evaluation // if (eval(result_sha,mail)) { // mail->msg("Your evaluation results are available at:"); // mail->msg("http://www.cvlibs.net/datasets/kitti/user_submit_check_login.php?benchmark=object&user=%s&result=%s",argv[2], result_sha.c_str()); // } else { // system(("rm -r results/" + result_sha).c_str()); // mail->msg("An error occured while processing your results."); // mail->msg("Please make sure that the data in your zip archive has the right format!"); // } // // // send mail and exit // delete mail; // // return 0; //}