Cookies help us deliver our services. By using our services, you agree to our use of cookies. Learn more

crowdAI is shutting down - please read our blog post for more information

Torch Tutorial for PlantVillage Challenge

Torch Tutorial for PlantVillage Challenge.

To evaluate our model on the test set, we will predict on 4 corner patches and center crop from image and its horizontal reflection. We will then average the output from all these as our prediction.

Our evaluation script then looks like:

    local function findImages(dir)
        -- Returns a table with all the image paths found in
        -- dir using 'find'

    -- Ten Crops
    local t = require 'datasets/transforms'
    local transform = t.Compose{

    -- predict for all image
    for _,imgpath in ipairs(findImages(arg[2])) do
       local img = image.load(imgpath, 3, 'float')
       local name = paths.basename(imgpath)

       -- Scale, normalize, and ten crop the image
       -- View as mini-batch of size 10
       img_batch = transform(img)

       -- Get the output of the softmax and average it
       local output = model:forward(img_batch):mean(1)[1]

        -- print the name and output in correct form.