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 init, receiveImage, receiveAnnotations and labelImage 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):

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

    N = parseInt(readLine())    
    len = parseInt(readLine())
    for (i=0; i < len; i++)
        metaData[i] = readLine()
    cmd = init(metaData, N)
    printLine(cmd)
    flush(stdout)
    
    while (true)
    {
        visualcmd = parseInt(readLine())
        if (visualcmd = 0) 
        {   
            exit
        }
        if (visualcmd = 1)
        {
            imageId = readline()
            imageSize = parseInt(readline())
            for (i=0;i < imageSize; i++)
                imageData[i] = parseInt(readline())
            cmd = receiveImage(imageId, imageData);
            printLine(cmd)
            flush(stdout)                
        }
        if (visualcmd = 2)
        {
            imageId = readline()
            annotatorIndex = parseInt(readline())
            len = parseInt(readline())
            for (i=0;i < len; i++)
                annotations[i] = readline()
            cmd = receiveAnnotations(imageId, annotatorIndex, annotations);
            printLine(cmd)
            flush(stdout)                
        }
        if (visualcmd = 3)
        {
            imageSize = parseInt(readline())
            for (i=0;i < imageSize; i++)
                imageData[i] = parseInt(readline())
            labels = labelImage(imageData)
            printLine(length(labels))
            for (i=0;i < length(labels); i++)
                printLine(labels[i])
            flush(stdout)                
        }
    }

The tester can be run in different modes.

1: java -jar tester.jar -conv <image file> -out <output file>

The tester will load the "image file", convert it into an array of integers A (according to the format specified in the statement) and will save A into the "output file" as follows:

N (length of A)
A[0]
A[1]
...
A[N-1]

NOTE: in all modes, the tester is able to process the provided training images, but it is not guaranteed to be able to work with any other images.

2: java -jar tester.jar -folder <folder> -training <training file> -test <test file> -exec <exec command> -vis <image prefix> 

This is the most powerful mode. Your solution supplied by "exec command" will be executed on a training and test set specified by "training file" and "test file". Both your and the crowd annotations will be visualized and the result will be saved to files specified by "image prefix".

"exec command" should contain a path to an executable of your solution. "training file" and "test file" should point to the supplied example_train.csv and example_test.csv (or another file in the same format). "folder" specifies the directory in which all the example data is stored.

Visualization results will be saved in PNG format into files "image prefix"_XX.png. Where XX is the number of the test image. Each predicted location of your algorithm is visualized with a red and black circle with a red dot at the center. The crowd annotations for the image is visualized as well. Green circles indicate modern structures and white circles indicate other objects.

 

Sample usage

Download the training data, put it into some folder at your machine and extract archives. The contents of your folder should be like:

data
example_train.csv
example_test.csv

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.

Now you can run the tester like this:

java -jar tester.jar -folder data -training example_train.csv -test example_test.csv -exec solution[.exe] -vis result

This will execute your solution using the example test case data. The visualizations will be saved to images result_XX.png.

 

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.