Upgoat or Downgoat?

311

87

Given an image of a goat, your program should best try to identify whether the goat is upside down, or not.

Examples

These are examples of what the input may be. Not actual inputs

Input:

Downgoat

Output: Downgoat

Spec

Your program should be at most 30,000 bytes

  • The input will contain the full goat
  • The picture will always contain a goat
  • If the goat is upside down, output Downgoat, otherwise Upgoat

Input will be however you can take an image as an input (file name, base64 of the image, etc.)

Don't rely on the image name or other metadata for containing "Upgoat" or "Downgoat" as the gist file names are just for reference.


Please don't hardcode. It's boring, I can't enforce it completely but I can ask nicely.

Test Cases

Gist with images. images beginning with downgoat have Downgoat output and images beginning with upgoat have Upgoat output.

Second Batch of Test Cases Make sure to test your images on all the test cases. These images are a jpgs. The image sizes do vary but not by that much.


Note: A few test cases may be added before accepting an answer to avoid answers which hardcode and to check the general performance of the program.

Bonus points for getting my avatar correct :P

Scoring

Score is a percent which can be calculated by: (number_correct / total) * 100

Downgoat

Posted 2016-02-09T23:30:34.670

Reputation: 27 116

1Does "fitting" count as hard-coding? – Nick T – 2016-02-13T18:48:52.663

@NickT what do you mean by "fitting"? – Downgoat – 2016-02-13T18:49:46.193

@Downgoat coming up parameters for a model (equation) that outputs if the goat is facing the correct way. By ""fitting"" I mean fitting the model to the entire data set, versus some training set. – Nick T – 2016-02-13T18:53:36.240

https://en.wikipedia.org/wiki/Overfitting – Nick T – 2016-02-13T19:03:38.927

@NickT Well if it does comply with the rules you can post it. Though I will be adding a third batch of test cases and if your answer wouldn't handle different test cases too well I would advise against it (i.e. hardcoding). – Downgoat – 2016-02-13T19:07:51.897

29I'm curious to see how these solutions will handle two goats in one picture. – Daniel – 2016-02-15T02:33:19.210

Just noticed the github's captcha when creating a new account is basically this question – OganM – 2019-10-03T23:55:40.327

Answers

294

Mathematica, 100%, 141 bytes

f@x_:=Count[1>0]@Table[ImageInstanceQ[x,"caprine animal",RecognitionThreshold->i/100],{i,0,50}];If[f@#>f@ImageReflect@#,"Up","Down"]<>"goat"&

Well, this feels more than a little like cheating. It's also incredibly slow as well as being very silly. Function f sees roughly how high you can set the Recognition threshold in one of Mathematica's computer vision builtins, and still recognise the image as a Caprine animal.

We then see whether the image or the flipped image is more goaty. Works on your profile image only because tie is broken in favour of downgoat. There are probably loads of ways this could be improved including asking it if the image represents Bovids or other generalisations of the Caprine animal entity type.

Answer as written scores 100% for the first testing set and 94% for the second testing set, as the algorithm yields an inconclusive result for goat 1. This can be raised back up to 100% at the expense of an even longer computational time by testing more values of RecognitionThreshold. Raising from 100 to 1000 sufficies; for some reason Mathematica thinks that's a very ungoaty image! Changing the recognition entity from Caprine animal to Hoofed Mammal also seems to work.

Ungolfed:

goatness[image_] := Count[
                      Table[
                        ImageInstanceQ[
                          image, Entity["Concept", "CaprineAnimal::4p79r"],
                          RecognitionThreshold -> threshold
                        ],
                        {threshold, 0, 0.5, 0.01}
                      ],
                      True
                    ]

Function[{image},
  StringJoin[      
    If[goatness[image] > goatness[ImageReflect[image]],
      "Up",
      "Down"
    ],
    "goat"
  ]
]

Alternative solution, 100% + bonus

g[t_][i_] := ImageInstanceQ[i, "caprine animal", RecognitionThreshold -> t]
f[i_, l_: 0, u_: 1] := Module[{m = (2 l + u)/3, r},
  r = g[m] /@ {i, ImageReflect@i};
  If[Equal @@ r,
   If[First@r, f[i, m, u], f[i, l, m]],
   If[First@r, "Up", "Down"] <> "goat"
   ]
  ]

This one uses the same strategy as before, but with a binary search over the threshold. There are two functions involved here:

  • g[t] returns whether or not its argument is a goaty image with threshold t.
  • f takes three parameters: an image, and an upper and lower bound on the threshold. It is recursive; it works by testing a threshold m between the upper and lower thresholds (biased towards the lower). If the image and the reflected image are both goaty or non-goaty, it eliminates the lower or upper part of the range as appropriate and calls itself again. Otherwise, if one image is goaty and the other is non-goaty, it returns Upgoat if the first image is goaty and Downgoat otherwise (if the second, reflected image is goaty).

The function definitions deserves a little explanation. First, function application is left-associative. This means that something like g[x][y] is interpreted as (g[x])[y]; "the result of g[x] applied to y."

Second, assignment in Mathematica is roughly equivalent to defining a replacement rule. That is, f[x_] := x^2 does not mean "declare a function named f with parameter x that returns x^2;" its meaning is closer to, "whenever you see something like f[ ... ], call the thing inside x and replace the whole thing with x^2."

Putting these two together, we can see that the definition of g is telling Mathematica to replace any expression of the form (g[ ... ])[ ... ] with the right-hand side of the assignment.

When Mathematica encounters the expression g[m] (in the second line of f), it sees that the expression does not match any rules that it knows and leaves it unchanged. Then it matches the Map operator /@, whose arguments are g[m] and the list {i, ImageReflect@i}. (/@ is infix notation; this expression is exactly equivalent to Map[g[m], { ... }].) The Map is replaced by applying its first argument to each element of its second argument, so we get {(g[m])[i], (g[m])[ ... ]}. Now Mathematica sees that each element matches the definition of g and does the replacement.

In this way we got g to act like a function that returns another function; that is, it acts roughly like we wrote:

g[t_] := Function[{i}, ImageInstanceQ[i, "caprine animal", RecognitionThreshold -> t]]

(Except in this case g[t] on its own evaluates to a Function, whereas before g[t] on its own was not transformed at all.)

The final trick I use is an optional pattern. The pattern l_ : 0 means "match any expression and make it available as l, or match nothing and make 0 available as l." So, if you call f[i] with one argument (the image to test) it is as if you had called f[i, 0, 1].

Here is the test harness I used:

gist = Import["https://api.github.com/gists/3fb94bfaa7364ccdd8e2", "JSON"];
{names, urls} = Transpose[{"filename", "raw_url"} /. Last /@ ("files" /. gist)];
images = Import /@ urls;
result = f /@ images
Tally@MapThread[StringContainsQ[##, IgnoreCase -> True] &, {names, result}]
(* {{True, 18}} *)

user = "items" /.
           Import["https://api.stackexchange.com/2.2/users/40695?site=codegolf", "JSON"];
pic = Import[First["profile_image" /. user]];
name = First["display_name" /. user];
name == f@pic
(* True *)

A Simmons

Posted 2016-02-09T23:30:34.670

Reputation: 4 005

344Mathematica has a builtin for determining goats. I don't know how to feel about that. – Robert Fraser – 2016-02-10T15:21:39.443

119Whaaat O.o there's a builtin for this.... Wow... – Downgoat – 2016-02-10T15:23:38.847

171You've goat to be kidding me... – corsiKa – 2016-02-10T15:57:08.877

1Really impressive. I had tried to exploit the asymmetry from the species detected, but failed. – njpipeorgan – 2016-02-11T03:04:12.080

28+1 for Mathematica being able to see which image is "more goaty". – QBrute – 2016-02-12T12:23:13.397

10This is positively ridiculous. +1. – ApproachingDarknessFish – 2016-02-13T07:27:19.683

3How does this program respond to two goats in one image? – Daniel – 2016-02-15T02:34:13.630

4Welcome to Mathematica, where there is quite literally, a built-in for everything! – Random Guy – 2016-02-16T00:03:02.467

71

JavaScript, 93.9%

var solution = function(imageUrl, settings) {

  // Settings
  settings = settings || {};
  var colourDifferenceCutoff = settings.colourDifferenceCutoff || 0.1,
      startX = settings.startX || 55,
      startY = settings.startY || 53;

  // Draw the image to the canvas
  var canvas = document.createElement("canvas"),
      context = canvas.getContext("2d"),
      image = new Image();
  image.src = imageUrl;
  image.onload = function(e) {
    canvas.width = image.width;
    canvas.height = image.height;
    context.drawImage(image, 0, 0);

    // Gets the average colour of an area
    function getColour(x, y) {

      // Get the image data from the canvas
      var sizeX = image.width / 100,
          sizeY = image.height / 100,
          data = context.getImageData(
            x * sizeX | 0,
            y * sizeY | 0,
            sizeX | 0,
            sizeY | 0
          ).data;

      // Get the average of the pixel colours
      var average = [ 0, 0, 0 ],
          length = data.length / 4;
      for(var i = 0; i < length; i++) {
        average[0] += data[i * 4] / length;
        average[1] += data[i * 4 + 1] / length;
        average[2] += data[i * 4 + 2] / length;
      }
      return average;
    }

    // Gets the lightness of similar colours above or below the centre
    function getLightness(direction) {
      var centre = getColour(startX, startY),
          colours = [],
          increment = direction == "above" ? -1 : 1;
      for(var y = startY; y > 0 && y < 100; y += increment) {
        var colour = getColour(startX, y);

        // If the colour is sufficiently different
        if(
          (
            Math.abs(colour[0] - centre[0]) +
            Math.abs(colour[1] - centre[1]) +
            Math.abs(colour[2] - centre[2])
          ) / 256 / 3
          > colourDifferenceCutoff
        ) break;
        else colours.push(colour);
      }

      // Calculate the average lightness
      var lightness = 0;
      for(var i = 0; i < colours.length; i++) {
        lightness +=
          (colours[i][0] + colours[i][1] + colours[i][2])
          / 256 / 3 / colours.length;
      }

      /*
      console.log(
        "Direction:", direction,
        "Checked y = 50 to:", y,
        "Average lightness:", lightness
      );
      */
      return lightness;
    }

    // Compare the lightness above and below the starting point
    //console.log("Results for:", imageUrl);
    var above = getLightness("above"),
        below = getLightness("below"),
        result = above > below ? "Upgoat" : "Downgoat";
    console.log(result);
    return result;
  };
};
<div ondrop="event.preventDefault();r=new FileReader;r.onload=e=>{document.getElementById`G`.src=imageUrl=e.target.result;console.log=v=>document.getElementById`R`.textContent=v;solution(imageUrl);};r.readAsDataURL(event.dataTransfer.files[0]);" ondragover="event.preventDefault()" style="height:160px;border-radius:12px;border:2px dashed #999;font-family:Arial,sans-serif;padding:8px"><p style="font-style:italic;padding:0;margin:0">Drag & drop image <strong>file</strong> (not just link) to test here... (requires HTML5 browser)</p><image style="height:100px" id="G" /><pre id="R"></pre></div>

Explanation

Simple implementation of @BlackCap's idea of checking where the light is coming from.

Most of the goats are in the centre of their images, and their bellies are always darker than their backs because of the sunlight. The program starts at the middle of the image and makes a note of the colour. It then gets the average lightness of the pixels above and below the centre up to where the colour is different to the colour at the centre (when the body of the goat ends and the background starts). Whichever side is lighter determines whether it is an upgoat or a downgoat.

Fails for downgoat 9 and upgoats 7 and 9 in the second test case.

user81655

Posted 2016-02-09T23:30:34.670

Reputation: 10 181

4

Nice! I didn't expect a 100% to be so easy. I've added a second batch of test cases, can you update your answer based on that?

– Downgoat – 2016-02-10T16:01:33.783

Here's an alternative link does that work? – Downgoat – 2016-02-10T23:30:49.280

@Downgoat Yep. Score updated. – user81655 – 2016-02-10T23:37:49.317

Unfortunately, it fails after I rotated the image 180° and flipped it vertically. screenshot

– mr5 – 2016-02-12T07:57:58.543

@mr5 Interesting... So is the image in your screenshot slightly different to downgoat 4? Also there are slight differences between browsers (and maybe operating systems?). With the parameters in this answer I got these same results for both Chrome and Firefox (using Windows). – user81655 – 2016-02-12T08:33:45.083

@mr5 That's the same as flipping horizontally... – wizzwizz4 – 2016-05-15T10:27:34.010

64

Python, 100%, 225 bytes

import requests

SEARCH = "http://www.bing.com/images/searchbyimage?FORM=IRSBIQ&cbir=sbi&imgurl="
THRESHOLD = 30
url = raw_input()
print "Upgoat" if requests.get(SEARCH + url).content.count('img') > THRESHOLD else "Downgoat"

Use reverse image search on the goat. If the page returns a satisfiable amount of results, it is probably an upwards goat. This solution will probably not work on hand-drawn goats or if Bing ever gets corrupted.

jasonshao

Posted 2016-02-09T23:30:34.670

Reputation: 838

32

I'm not sure on how I feel about this answer. It's borderline valid, and is nearly violating this loophole. Currently it is breaking the explicit rule that the input is either a file, or local path, not a url. It's in interesting answer but considering how borderline valid it is, I'd say it's competitiveness is questionable.

– Downgoat – 2016-02-11T05:05:55.767

50@Downgoat so you downgoated his answer? – Ave – 2016-02-11T06:15:51.243

2fix it by uploading the file to imgur or something^^ Also why in the world would you use bing??? – Eumel – 2016-02-11T11:49:24.420

@Eumel: I'm guessing (I hope) that it's because "bing" is 2 bytes shorter than "google". Although this isn't code-golf, so that shouldn't matter... – Darrel Hoffman – 2016-02-11T14:06:55.823

17@Eumel Because Google checks if the User-Agent in the HTTP request belongs to an actual web browser (or something they allow) and not to some other application or script. Bing doesn't check that, they're kinda desperate about getting incoming requests. I guess User-Agent can be faked with extra code and wouldn't matter since this is not code-golf. – JordiVilaplana – 2016-02-11T14:14:28.570

@Downgoat sorry I didn't realize using a URL was a violation. I can easily modify it as reverse image search allows uploading the file. – jasonshao – 2016-02-11T20:02:48.303

@JordiVilaplana, you're absolutely right, it's pretty much impossible to scrape the Google page content whereas Bing was quite open to it. – jasonshao – 2016-02-11T20:04:13.990

1It will also start failing if @Downgoat stops getting his test images from Google/Bing image search. – OrangeDog – 2016-02-12T16:49:04.010

1

This is uncomfortably close to abusing a standard loophole.

– Mego – 2016-07-01T21:29:44.907

15That standard loophole is there for code golf answers to make them smaller. This is not a code golf challenge so I don't see why the loophole would apply – SztupY – 2016-07-20T15:48:45.583

59

Java, 93.9% 100%

This works by determining the row contrast in the upper and lower part of the image. I assume that the contrast in the bottom half of the image is bigger for 2 reasons:

  • the 4 legs are in the bottom part
  • the background in the upper part will be blurred because it is usually the out-of-focus-area

I determine the contrast for each row by calculating the difference of neighboring pixel values, squaring the difference, and summing all squares.

Update

Some images from the second batch caused problems with the original algorithm.

upgoat3.jpg

This image was using transparency which was ignored previously. There are several possibilities to solve this problem, but I simply chose to render all images on a 400x400 black background. This has the following advantages:

  • handles images with alpha channel
  • handles indexed and grayscale images
  • improves performance (no need to process those 13MP images)

downgoat8.jpg/upgoat8.jpg

These images have exaggerated detail in the body of the goat. The solution here was to blur the image in vertical direction only. However, this generated problems with images from the first batch, which have vertical structures in the background. The solution here was to simply count differences which exceed a certain threshold, and ignore the actual value of the difference.

Shortly said, the updated algorithm looks for areas with many differences in images that after the preprocessing look like this:

enter image description here

import java.awt.Graphics2D;
import java.awt.RenderingHints;
import java.awt.image.BufferedImage;
import java.awt.image.Raster;
import java.io.File;
import java.io.IOException;

import javax.imageio.ImageIO;

public class UpDownGoat {
    private static final int IMAGE_SIZE = 400;
    private static final int BLUR_SIZE = 50;

    private static BufferedImage blur(BufferedImage image) {
        BufferedImage result = new BufferedImage(image.getWidth(), image.getHeight() - BLUR_SIZE + 1,
                BufferedImage.TYPE_INT_RGB);
        for (int b = 0; b < image.getRaster().getNumBands(); ++b) {
            for (int x = 0; x < result.getWidth(); ++x) {
                for (int y = 0; y < result.getHeight(); ++y) {
                    int sum = 0;
                    for (int y1 = 0; y1 < BLUR_SIZE; ++y1) {
                        sum += image.getRaster().getSample(x, y + y1, b);
                    }
                    result.getRaster().setSample(x, y, b, sum / BLUR_SIZE);
                }
            }
        }
        return result;
    }

    private static long calcContrast(Raster raster, int y0, int y1) {
        long result = 0;
        for (int b = 0; b < raster.getNumBands(); ++b) {
            for (int y = y0; y < y1; ++y) {
                long prev = raster.getSample(0, y, b);
                for (int x = 1; x < raster.getWidth(); ++x) {
                    long current = raster.getSample(x, y, b);
                    result += Math.abs(current - prev) > 5 ? 1 : 0;
                    prev = current;
                }
            }
        }
        return result;
    }

    private static boolean isUp(File file) throws IOException {
        BufferedImage image = new BufferedImage(IMAGE_SIZE, IMAGE_SIZE, BufferedImage.TYPE_INT_RGB);
        Graphics2D graphics = image.createGraphics();
        graphics.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BICUBIC);
        graphics.drawImage(ImageIO.read(file), 0, 0, image.getWidth(), image.getHeight(), null);
        graphics.dispose();
        image = blur(image);
        int halfHeight = image.getHeight() / 2;
        return calcContrast(image.getRaster(), 0, halfHeight) < calcContrast(image.getRaster(),
                image.getHeight() - halfHeight, image.getHeight());
    }

    public static void main(String[] args) throws IOException {
        System.out.println(isUp(new File(args[0])) ? "Upgoat" : "Downgoat");
    }
}

Sleafar

Posted 2016-02-09T23:30:34.670

Reputation: 2 722

Here's an alternative link does that work? – Downgoat – 2016-02-10T23:30:58.160

@Downgoat Yes, that worked. I updated the score (not including the bonus points for your avatar which is recognized correctly :). – Sleafar – 2016-02-11T05:33:25.850

38

Python 3, 91.6%

-edited with the new test cases

set filename to the goat picture you wish to test. It uses a kernel to make an image top/bottom asymmetric.I tried the sobel operator, but this was better.

from PIL import Image, ImageFilter
import statistics
k=(2,2,2,0,0,0,-2,-2,-2)
filename='0.png'
im=Image.open(filename)
im=im.filter(ImageFilter.Kernel((3,3),k,1,128))
A=list(im.resize((10,10),1).getdata())
im.close()
a0=[]
aa=0
for y in range(0,len(A)):
    y=A[y]
    a0.append(y[0]+y[1]+y[2])
aa=statistics.mean(a0)
if aa<383.6974:
    print('Upgoat')
else:
    print('Downgoat')

Magenta

Posted 2016-02-09T23:30:34.670

Reputation: 1 322

3+1 Nice job! I should really figure out how to install PIL on a Mac... – Downgoat – 2016-02-10T05:12:14.280

I've added a second batch of test cases, can you update your answer based on that?

– Downgoat – 2016-02-10T16:01:54.407

@Downgoat just did – Magenta – 2016-02-10T17:26:13.357

@Downgoat pip install Pillow – Assaf Lavie – 2016-02-12T07:59:42.457

17

OpenCV with Hough Transform, 100%

My original idea was to detect the vertical lines of the goat's legs and determine its vertical position relative to the body and horizon.

As it turns out, in all the images, the ground is extremely noisy, making lots of Canny edge detection output and corresponding detected lines from the Hough transform. My strategy was then to determine whether the horizontal lines lie in the upper or lower half of the image, which was enough to solve the problem.

# Most of this code is from OpenCV examples
import cv2
import numpy as np

def is_upgoat(path):
    img = cv2.imread(path)
    height, width, channels = img.shape
    gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
    edges = cv2.Canny(gray, 100, 200, apertureSize=3)

    lines = cv2.HoughLines(edges, 1, np.pi/180, 200, None, 0, 0, np.pi/2-0.5, np.pi/2+0.5)
    rho_small = 0

    for line in lines:
        rho, theta = line[0]
        a = np.cos(theta)
        b = np.sin(theta)
        x0 = a*rho
        y0 = b*rho
        x1 = int(x0 + 5000*(-b))
        y1 = int(y0 + 5000*(a))
        x2 = int(x0 - 5000*(-b))
        y2 = int(y0 - 5000*(a))

        if rho/height < 1/2: rho_small += 1
        cv2.line(img,(x1,y1),(x2,y2),(0,0,255),1, cv2.LINE_AA)

    output_dir = "output/"
    img_name = path[:-4]
    cv2.imwrite(output_dir + img_name + "img.jpg", img)
    cv2.imwrite(output_dir + img_name + "edges.jpg", edges)

    return rho_small / len(lines) < 1/2


for i in range(1, 10):
    downgoat_path = "downgoat" + str(i) + ".jpg"
    print(downgoat_path, is_upgoat(downgoat_path))

for i in range(1, 10):
    upgoat_path = "upgoat" + str(i) + ".jpg"
    print(upgoat_path, is_upgoat(upgoat_path))

Here's the entire function without outputting images:

def is_upgoat(path):
    img = cv2.imread(path)
    height, width, channels = img.shape
    gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
    edges = cv2.Canny(gray, 100, 200, apertureSize=3)

    lines = cv2.HoughLines(edges, 1, np.pi/180, 200, None, 0, 0, np.pi/2-0.5, np.pi/2+0.5)
    rho_small = 0

    for line in lines:
        rho, theta = line[0]
        if rho/height < 1/2: rho_small += 1

    return rho_small / len(lines) < 1/2

Downgoat1 edges:

Downgoat1 edges

Downgoat1 lines:

Downgoat1 lines

Upgoat2 edges and lines:

Upgoat2 edges Upgoat2 lines

The method even worked well on particularly noisy images. Here's downgoat3 edges and lines:

downgoat3 edges downgoat3 lines


Addendum

It turns out median blur and adaptive Gaussian thresholding before the Hough Transform works much better than Canny edge detection, mostly since median blur is good in noisy areas. However the problems of my original approach immediately are clear: prominent background lines are detected, as well as the goat's face in some pictures.

def is_upgoat2(path):
    img = cv2.imread(path)
    #height, width, channels = img.shape
    gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
    gray = cv2.medianBlur(gray, 19)
    thresh = cv2.adaptiveThreshold(gray, 255, cv2.ADAPTIVE_THRESH_GAUSSIAN_C,
                                   cv2.THRESH_BINARY_INV, 11, 2)

    lines = cv2.HoughLinesP(thresh, 1, np.pi / 180, threshold=100,
                            minLineLength=50, maxLineGap=10)

    vert_y = []
    horiz_y = []
    for line in lines:
        x1, y1, x2, y2 = line[0]
        # Vertical lines
        if x1 == x2 or abs((y2-y1)/(x2-x1)) > 3:
            vert_y.append((y1+y2)/2)
            cv2.line(img, (x1, y1), (x2, y2), (0, 255, 0), 2)

        # Horizontal lines
        if x1 != x2 and abs((y2-y1)/(x2-x1)) < 1/3:
            horiz_y.append((y1+y2)/2)
            cv2.line(img, (x1, y1), (x2, y2), (0, 0, 255), 2)


    print(np.median(vert_y), np.median(horiz_y))

Here's downgoat8:

downgoat8 thresh downgoat8 edges

Contours (code not shown) detect the top edge of the goat (spine) pretty well but fail to get the entire shape.

contours

Further research: OpenCV has Haar-feature based object detection which is usually used for things like cars and faces, but it could probably work for goats too, given their distinctive shape.

2D Feature recognition looks promising (template matching won't work because of scaling and rotation) but I'm too lazy to figure out OpenCV for C++.

qwr

Posted 2016-02-09T23:30:34.670

Reputation: 8 929

11

Python 3, numpy, scikit, 100%

This code runs a goat-trained image classifier against a single filename, printing out 'Upgoat' or 'Downgoat'. The code itself is one line of python3, preceded by a single gigantic string, and an import line. The giant string is actually the goat-trained classifier, which is unpickled at runtime and given the input image for classification.

The classifier was created by using the TPOT system, from Randal Olson and team at the University of Pennsylvania. TPOT helps to evolve machine-learning image classifier pipelines using genetic programming. Basically it uses artificial selection to choose various parameters and types of classification to work best with the input data you give it, so you don't have to know much about machine learning to get a pretty good pipeline setup. https://github.com/EpistasisLab/tpot . TPOT runs on top of scikit-learn, of INRIA et al, http://scikit-learn.org/stable/

I gave TPOT about a hundred goat images that I found on the internet. I chose ones that looked relatively similar to the goats in Test, i.e. "in a field", from the side, without much else going on in the image. The output of this TPOT process was basically a scikit-learn ExtraTreesClassifier object. This image classifier, after being trained (or 'fit') on my goats, was pickled into the huge string. The string, then, contains not just classifier code, but the "imprint" of the training of all the goat images it was trained on.

I cheated slightly during training, by including the 'goat standing on a log' test image in the training images, but it still works pretty well on generic goat-in-a-field images. There seems to be a tradeoff - the longer I let TPOT run, the better classifier it created. However, better classifiers also seem to be 'bigger' and eventually run up against the 30,000 byte limit given by @Downgoat in the golf game. This program as it stands is currently at about 27kbytes. Please note that the 'second group' of test images is broken, as is the 'backup link', so I'm not sure how it would do on them. If they were to be repaired, I would probably start over, rerun TPOT and feed it a bunch of new images, and see if I could create a new classifier under 30k bytes.

Thanks

import pickle,bz2,base64,numpy,sys,skimage.transform,skimage.io
s='''
QlpoOTFBWSZTWbH8iTYAp4Z/////////////////////////////////////////////4E6fAAPR
OCLRpIfAbvhgIAAAAJCgAG68fDuYNrAwQbsADQAKBIJBITroq0UyRVNGVqljJVSvgAAAAEgAAAAA
AAO7AABugXamjQYyCIABQ6O7LEQ2hRwOdKSFCVuGgF1jBthaAUAAEgKGLVAAAAAKKCVFBIFEFKVE
DQNAaNPUGjTJjU000G1PU0ZAaaGJoyDQaDaQxPRP0oZpNo9NRGaJtRoaYmmyammnqGAjTBNpG1Ga
mT01GRoemTFNnoRNPZCm09pmP9VVVBlIgAAAmgAAExNAaBo0A1MA0ZAADRMCZoAajBNMGjTSntAC
YJgGiYJjU0YNTTCYCYTANABMATKHInox/7VSqoZMgG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R57uIuyP6wkaW2JAprdq9w9EpFoUeSbl7a7F9PjWsiBmAgY3r3ePVBlVEoMPe3
O9cQdd6PWGEBoO37at+5dF+QAGt09ODv53V/e5D1ECNjYVlx/s+fB3+yrXxFKOWJJzXMe/Qtqhjg
IljLH0OeH6nbW3U5Tf78Q0uY6rxzGXG+F8C0K4a+E4nmxVxbwit7QEFOk2lfszEG+ggIIlbcPP6G
S/84Fp8AMwakQn2JjdgACpWYA7bjIRrLGtDkL0EC/wzdu+ttg9GUvl3BuQv7OJHS9NQBw+YEEKV0
BXkDbI36AKvsHLP1g1/iP8aSBr8podjCY2fuLHnOOX4sthQSSyUwlC97ntxmDg28dRtbzRuQ0wP8
3V62hO9nc7X9fb9fznzhRBNYF5IFEEjJQBIKIJmK7I8Xh5Pn9xywJX7HKInI9jqQQbwACgmCD1RR
BPBFEE//F3JFOFCQsfyJNg==
'''
print(['','Up','Down'][int(pickle.loads(bz2.decompress(base64.b64decode(s))).predict(numpy.array([skimage.transform.resize(skimage.io.imread(sys.argv[1],as_grey=True),(24,12),mode='constant').flatten()]))[0])]+'goat')

update: per request here is the training data, resized to 24x12 and combined into a single image for ease of upload/presentation. its over a hundred images. http://deeplearning.net/datasets/ , http://www.vision.caltech.edu/Image_Datasets/Caltech256/, duckduckgo image search, google image search, etc

training data at 24x12 pixels

don bright

Posted 2016-02-09T23:30:34.670

Reputation: 1 189

Can you post your training data? – qwr – 2018-06-13T04:13:10.373

some of the original exact images i used are copyright so i cant post them all, however i have shrunk a bunch of them to the size used in the system, 24x12, and posted them in a single montage image above, which should qualify as 'fair use'. – don bright – 2018-06-14T07:37:40.390

6

Scikit-learn with Random Forests, 100%

The tried-and-true approach is convnets, but random forests can perform very well out-of-the-box (few parameters to tune). Here I show some general techniques in image classification tasks.

I started off with 100 images of goats for training I found through Google Images (AFAIK none in the training data match the test data). Each image is rescaled to 20x16 in grayscale, then the array is flattened to produce one row in a 2D array. A flipped version of the image is also added as a row for the training data. I did not need to use any data augmentation techniques.

grid of goats

Then I feed the 2D array into the random forest classifier and call predict to produce 50 decision trees. Here is the (messy) code:

RESIZE_WIDTH = 20
RESIZE_HEIGHT = 16

def preprocess_img(path):
    img = cv2.imread(path, 0)  # Grayscale
    resized_img = cv2.resize(img, (RESIZE_WIDTH, RESIZE_HEIGHT))
    return resized_img


def train_random_forest(downgoat_paths, upgoat_paths, data_paths):
    assert len(data_paths) == 100
    # Create blank image grid
    img_grid = np.zeros((10*RESIZE_HEIGHT, 10*RESIZE_WIDTH), np.uint8)

    # Training data
    TRAINING_EXAMPLES = 2*len(data_paths)
    train_X = np.zeros((TRAINING_EXAMPLES, RESIZE_WIDTH*RESIZE_HEIGHT), np.uint8)
    train_y = np.zeros(TRAINING_EXAMPLES, np.uint8)

    TEST_EXAMPLES = len(downgoat_paths) + len(upgoat_paths)
    test_X = np.zeros((TEST_EXAMPLES, RESIZE_WIDTH*RESIZE_HEIGHT), np.uint8)
    test_y = np.zeros(TEST_EXAMPLES, np.uint8)


    for i, data_path in enumerate(data_paths):
        img = preprocess_img(data_path)

        # Paste to grid
        ph = (i//10) * RESIZE_HEIGHT
        pw = (i%10) * RESIZE_WIDTH
        img_grid[ph:ph+RESIZE_HEIGHT, pw:pw+RESIZE_WIDTH] = img
        flipped_img = np.flip(img, 0)

        # Add to train array
        train_X[2*i,], train_y[2*i] = img.flatten(), 1
        train_X[2*i+1,], train_y[2*i+1] = flipped_img.flatten(), 0

    cv2.imwrite("grid.jpg", img_grid)

    clf = RandomForestClassifier(n_estimators=50, verbose=1)
    clf.fit(train_X, train_y)
    joblib.dump(clf, 'clf.pkl')

    for i, img_path in enumerate(downgoat_paths + upgoat_paths):
        test_X[i,] = preprocess_img(img_path).flatten()
        test_y[i] = (i >= len(downgoat_paths))


    predict_y = clf.predict(test_X)
    print(predict_y)
    print(test_y)
    print(accuracy_score(predict_y, test_y))

    # Draw tree 0
    tree.export_graphviz(clf.estimators_[0], out_file="tree.dot", filled=True)
    os.system('dot -Tpng tree.dot -o tree.png')


def main():
    downgoat_paths = ["downgoat" + str(i) + ".jpg" for i in range(1, 10)]
    upgoat_paths = ["upgoat" + str(i) + ".jpg" for i in range(1, 10)]
    data_paths = ["data/" + file for file in os.listdir("data")]

    train_random_forest(downgoat_paths, upgoat_paths, data_paths)

Here is the first decision tree (though since the model is in an ensemble, it is not particularly useful)

decision tree #0

qwr

Posted 2016-02-09T23:30:34.670

Reputation: 8 929

that is very interesting.... your training data seems a lot more diverse types of pictures than mine. – don bright – 2019-01-20T21:44:32.347

@donbright I would post my training data but the folder with all my pictures was on a hard drive that died. If anyone is ambitious enough, they can use reverse google image search and find the pictures I used. – qwr – 2019-01-28T21:25:38.967

thats cool. i downloaded a bunch of images but i spent a huge amount of time sorting through them for "clean" images. it is interesting to see how its possible to train based on more 'dirty' images without having to spend as much time sorting through maybe. – don bright – 2019-01-29T00:47:51.753

@donbright I believe more training data and variety is better. For "clean" and "dirty" we may use data augmentation to create "more data". – qwr – 2019-01-29T03:39:59.250