Downloads


In order to use the offline tester / visualizer tool for testing your solution locally, you'll have to modify your solution by adding the main method that interacts with the tester / visualizer via reading data from standard input and writing data to standard output. As long as you do not change the implementation of method trainingData, testingData and getAnswer this doesn't affect the way your solution works when being submitted to our server.

To simulate a single test case, your program should implement the following protocol (each integer/string is to be read from / printed in a separate line):

  1. For exactly 100 iterations do:
  2. For exactly 20 iterations do:
  3. Call result[] = getAnswer()
  4. Print the length of result[]
  5. Print each element in result[] on a line and flush the standard output stream

In other words, you should implement the following pseudocode in the main method of your solution:

    for (i=0; i < 100; i++)
    {
        W = parseInt(readLine())    
        H = parseInt(readLine())    
        for (f=0; f < 4; f++)
        {
            for (j=0; j < W*H; j++)
                imageData_[f][j] = readInt()
            N = parseInt(readLine())    
            for (j=0; j < N; j++)
                header_[f][j] = readLine()
            for (j=0; j < 8; j++)
                wcs_[f][j] = parseDouble(readLine())
        }
        N = parseInt(readLine())    
        for (j=0; j < N; j++)
            detections[j] = readLine()
        result = trainingData(W, H, imageData_[0], header_[0], wcs_[0], imageData_[1], header_[1], wcs_[1], imageData_[2], header_[2], wcs_[2], imageData_[3], header_[3], wcs_[3], detections)
        printLine(result)
        flush(stdout)
        if (result==1) break;
    }
    for (i=0; i < 20; i++)
    {
        imageID = readLine()
        W = parseInt(readLine())    
        H = parseInt(readLine())    
        for (f=0; f < 4; f++)
        {
            for (j=0; j < W*H; j++)
                imageData_[f][j] = readInt()
            N = parseInt(readLine())    
            for (j=0; j < N; j++)
                header_[f][j] = readLine()
            for (j=0; j < 8; j++)
                wcs_[f][j] = parseDouble(readLine())
        }
        result = testingData(imageID, W, H, imageData_[0], header_[0], wcs_[0], imageData_[1], header_[1], wcs_[1], imageData_[2], header_[2], wcs_[2], imageData_[3], header_[3], wcs_[3])
        printLine(result)
        flush(stdout)
    }
    results = getAnswer()
    printLine(length(results))
    for (i=0;i < length(results); i++)
        printLine(results[i])
    flush(stdout)      

The tester can be run as follows.

java -jar tester.jar -folder <folder> -train <training file> -test <test file> -exec <exec command> -seed <seed number> -vis <test number>

Your solution supplied by "exec command" will be executed on a training and test set specified by "training file" and "test file". The seed will be used to randomly select 20 images from the test set. Note that the -vis option is optional.

"exec command" should contain a path to an executable of your solution. "training file" and "test file" should point to the supplied traindata.txt file. In order to simulate the example test locally, both "training file" and "test file" must be traindata.txt. "folder" specifies the directory in which all the training data is stored.

Visualization results will be saved in PNG format into files. The test number will determine which one of the test images will be visualized. (Zero-based). If you want to visualize all of the 20 images, set the test number to -1. Note that this will consume a lot of memory. Ground truth detections will be shown in red, your detection that do not match any detection will be shown in blue. Your detections that matched ground truth detections will be shown in green.

 

Sample usage

Download the training data, put it into some folder at your machine and extract archives.

Modify your solution as explained above and put the executable (solution or solution.exe) into the same folder. Also put the provided tester.jar there, as well as all the other files such as Amors.txt, Apollos.txt and Atens.txt.

Now you can run the tester like this:

java -jar tester.jar -folder data/ -train traindata.txt -test traindata.txt -exec solution[.exe] -seed 1 -vis 1

This will execute your solution using the example test case data. The visualizations of the second test image will be saved.

 

Final notes

You can print any debug information of your solution to the standard error stream and it will be forwarded to the standard output of the tester.

For more information on using visualizers, please check the following recipe draft from TopCoder Cookbook. Note that this is not a troubleshooting thread, please use the match forum for questions instead.