I'm trying to get a simple webservice up which will allow me to post
image urls and classify them as matching a certain criteria or not. I
have a simple bottle.py server that accepts image urls to api
endpoints that determine the classification - something like:
/decisions/red/[positive, negative]
I would like for the model to be able to train and classify (even bad
classifications are okay) as people submit urls - but I am running
into this error, which I assume is happening because I am not training
on the entire dataset at once.
If that is the case, is there a way to train a model iteratively when
the entire dataset isn't available when the initial model is trained?
Here is a snippet of what my bottle.py setup looks like:
@post('/decisions/red/<decision>')
def decisions(decision='answer'):
# -- snipped --
# set answer to 0 for this snippet
answer = 0
tmpfile = tempfile.NamedTemporaryFile()
urllib.urlretrieve(request.forms.url,
tmpfile.name)
img = mahotas.imread(
tmpfile.name)
features = mahotas.features.haralick(img).mean(0)
learner.train([features], [answer])