Skip to content

Commit

Permalink
added shot score tracking and screen ouptut of results
Browse files Browse the repository at this point in the history
Added a score attribute to each shot to allow the confidence
of each shot boundary to be logged for precision/recall evaluations.
Modified the commandline inputs and film class so that results were
logged to the screen rather than to xml for the sake of fairer
timing benchmarks.
  • Loading branch information
albanie committed Mar 30, 2016
1 parent 225d640 commit 116999e
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 8 deletions.
14 changes: 7 additions & 7 deletions src/commandline.cc
Original file line number Diff line number Diff line change
Expand Up @@ -183,15 +183,15 @@ int main(int argc, char **argv) {
}

// Error handling
if (!ifile_set || !ofile_set || !id_set) {
if (!ifile_set || !id_set) {
if (!ifile_set) {
cerr << "ERROR: Input filename is missing or empty. See argument '-i'"
<< endl;
}
if (!ofile_set) {
cerr << "ERROR: Output path is missing or empty. See argument '-o'"
<< endl;
}
//if (!ofile_set) {
//cerr << "ERROR: Output path is missing or empty. See argument '-o'"
//<< endl;
//}
if (!id_set) {
cerr << "ERROR: please specify an alphanumeric id. See argument '-a'"
<< endl;
Expand All @@ -205,8 +205,8 @@ int main(int argc, char **argv) {

f.shotlog("Processing movie.");
f.process();
string xml_path = "result.xml";
f.x->write_data(xml_path);
//string xml_path = "result.xml";
//f.x->write_data(xml_path);
/*string finished_path = f.global_path;
finished_path += "/finished";
FILE *fd_finished = fopen(finished_path.c_str(),"w");
Expand Down
9 changes: 8 additions & 1 deletion src/film.cc
Original file line number Diff line number Diff line change
Expand Up @@ -176,12 +176,19 @@ void film::CompareFrame(AVFrame *pFrame, AVFrame *pFramePrev) {
*/
if ((diff > this->threshold) && (score > this->threshold)) {
shot s;
s.score = score;
s.fbegin = frame_number;
s.msbegin = int((frame_number * 1000) / fps);
s.myid = shots.back().myid + 1;

/*
* Print frame times and scores to scren
*/

cout << ",time:" << s.msbegin << ",score:" << s.score;

#ifdef DEBUG
cerr << "Shot log :: " << s.msbegin << endl;
//cerr << "Shot log :: " << s.msbegin << endl;
#endif

/*
Expand Down
3 changes: 3 additions & 0 deletions src/shot.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ class shot {
public:
int myid;

/* track score */
double score;

/* Durée en frame */
int fduration;
/* Stating point (frame) */
Expand Down
5 changes: 5 additions & 0 deletions src/xml.cc
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,11 @@ void xml::write_data(string &filename) {
rc = xmlTextWriterWriteAttribute(writer, BAD_CAST "msduration",
BAD_CAST strflx.str().c_str());

strflx.str("");
strflx << (*il).score;
rc = xmlTextWriterWriteAttribute(writer, BAD_CAST "score",
BAD_CAST strflx.str().c_str());

strflx.str("");
strflx << (*il).fbegin;
rc = xmlTextWriterWriteAttribute(writer, BAD_CAST "fbegin",
Expand Down

0 comments on commit 116999e

Please sign in to comment.