Error 400 when Creating Custom Classifier in Watson Visual Recognition - ibm-watson

I am currently facing a problem to create my own classfiers. I already tried to build a NodeJS application and also create it using IBM's demo, but everytime I submit my ZIP folders to be created, I recieve the following error message:
Cannot execute learning task. : need at least 2 _positive_examples fields, (or 1 _positive_examples and 1 negative_examples field) to train a classifier. null specified.
However, when I tried to use the IBM Demo webapp using the .zip they provide (husky, beagle and cats.zip files) the classifier is successfully createdi
I have currently 2 zips (1 positive and 1 negative) each containing 50 files named from 1.jpg to 50.jpg.
Have any of you guys ever gone through this issue and found a way to handle it?
Thanks for the attention.
Best regards,
Enrico Bergamo

As per the discussion on the DeveloperWorks Forum ( https://developer.ibm.com/answers/questions/377690/error-400-when-trying-to-create-a-custom-classifie/ ), Your zip files are not really zips. It looks like all you have done is name your folder positive.zip.
Right click on each of the folders in turn and select create zip or compress as zip.

What this message indicates is that the service is not receiving any POST fields that end in '_positive_examples' which is necessary for a training request. So double check your form field name parameters.

Related

2sxc Adam folder list

I have a problem with listing/showing Folders created within Adam's File Library?
I have dowloaded Adam 2.0 tutorial from your site
I can't get them listed even in downloaded template and example "Another one rides the bus". If I change template view "Adam example with groups (folders) I don't see any image at all.
I tried adding #screenshots.Folders.Count but I get value 0 even there are already 2 non-empty folders created in given example gallery.
For #screenshots.Files.Count I get 4 which is correct value for a root level.
I get no other errors.
Thanks!
I'm not sure if those examples are all still current. But if you check out the latest Blueimp that may help. See https://2sxc.org/en/apps/app/blueimp-gallery-slider-4-0-with-koi-bootstrap-3-and-4.

Freebase: What data dump file contains the "imdb_id"?

I run IMDbAPI.com and have been using Bing's Search API for finding IMDb ID's from title searches. Bing is currently changing their API over to the Azure Marketplace (August 1st) and is no longer available for free. I started testing my API using Freebase to resolve these ID's and hit their 100k limit in the first 8 hours (my site currently gets about 3 million requests a day, but only 200-300k are title searches)
This is exactly why they offer the data dump files,
I downloaded most of the files in the Film folder but cannot find where they are storing the "/authority/imdb/title" imdb id namespace data.
https://www.googleapis.com/freebase/v1/mqlread?query={"type":"/film/film","name":"True%20Grit","imdb_id":null,"initial_release_date>=":"1969-01","limit":1}
This is how I'm currently accessing the ID.
Does anyone know which file contains this information? and how to link back to it from the film title/id?
That imdb_id property is backed by a key in the /authority/imdb/title namespace, so you're looking for the line:
/m/015gxt /type/object/key /authority/imdb/title tt0065126
in the file http://download.freebase.com/datadumps/latest/freebase-datadump-quadruples.tsv.bz2
That's a 4 GB file, so be prepared to wait a little while for the download. Note that everything is keyed by MID, so you'll need to figure that out first if you don't have it in your database.
The equivalent query using MQL instead of the data dumps is https://www.googleapis.com/freebase/v1/mqlread?query=%7B%22type%22%3a%22/film/film%22,%22name%22%3a%22True%20Grit%22,%22imdb_id%22%3anull,%22initial_release_date%3E=%22%3a%221969-01%22,%22mid%22:null,%22key%22:[{%22namespace%22:%22/authority/imdb/title%22}],%22limit%22:1%7D&indent=1
EDIT: p.s. I'm pretty sure the files in the Browse directory are going away, so I wouldn't depend on them even if you could find the info there.
The previous answer works fine, it's just that a snappier version of such a query could be:
query = [{
'type': '/film/film',
'name': 'prometheus',
'imdb_id': null,
...
}];
The rest of the MQL request isn't mentionned as it doesn't differ from the aforementioned. Hope that helps.

Difficulty with filename and filemime when using Migrate module

I am using the Drupal 7 Migrate module to create a series of nodes from JPG and EPS files. I can get them to import just fine. But I notice that when I am done importing them if I look at the nodes it creates, none of the attached filefield and thumbnail files contain filename information.
Upon inspecting the file_managed table I see that both the filename and filemime fields are empty for ONLY the files that I attached via the migrate module. This also creates an issue with downloading the files.
Now I think the problem has to do with the fact that I am using "file_link" instead of "file_copy" as the file operation I specify. The problem is I am importing around 2TB (thats Terabytes) of image files. We had to put in a special request with Rackspace just to get access to that much disk space on our server. So I can't go around copying from one directory to the next because of space issues. So "file_link" seems like the obvious choice.
Now you probably want to see how I am doing this exactly, so here is the code snippet:
$jpg_arguments = MigrateFileFieldHandler::arguments(NULL,
'file_link', FILE_EXISTS_RENAME, 'en', array('source_field' => 'jpg_name'),
array('source_field' => 'jpg_filename'), array('source_field' => 'jpg_filename'));
$this->addFieldMapping('field_image', 'jpg_uri')
->arguments($jpg_arguments);
As you can see I am specifying no base path (just like the beer.inc example file does). I have set file_link, the language, and the source fields for the description, title, and alt.
It is able to generate thumbnails from the JPGs. But still missing those columns of data in the db table. I traced through the functions the best I could but I don't see what is causing this. I tried running the uri in the table through the functions that generate the filename and the filemime and they output just fine. It is like something is removing just those segments of data.
Does anyone have any idea what this could be? I am using the Drupal 7 Migrate module version 2.2. It is running on Drupal 7.8.
Thanks,
Patrick
Ok, so I have found the answer to yet another question of mine. This is actually an issue with the migrate module itself. The issue is documented here. I will be repealing this bounty (as soon as I figure out how).

What is the lifespan of files saved to CFFileServlet with Coldfusion

I have to serve captcha image (in Coldfusion) without saving permanent files per request, so I am using cfimage without a source destination and the action set to captcha.
This returns a file like this:
From what I've tested, these files are seem to be temporary they become unavailable after around 5min. This fits my need, but I've been trying to find documentation regarding CFFileServlet, how it works, etc... with no luck...
Any thoughts?
Thanks, Phill
Not documented AFAIK, and yes they get deleted around 5 minutes after created.

Receive multi file post with google app engine

I want to receive multi file post from image uploader.(i use this)
Most examples show how to receive one image from post.
I tried many ways but never got the results.
For example
self.request.POST['Filename']
gives only first filename.
What to do when there are multiple files/images in post?
The reason for this is to resize before upload images, that are too big for google app engine
to upload.
EDIT:
self.request.POST.multi.__dict__
shows
{'_items':
[('Filename', 'camila1.jpg'),
('Filedata[]', FieldStorage('Filedata[]', 'camila1.jpg')),
('Upload', 'Submit Query\r\n--negpwjpcenudkacqrxpleuuubfqqftwm----negpwjpcenudkacqrxpleuuubfqqftwm\r\nContent-Disposition: form-data; name="Filename"\r\n\r\nbornToBeWild1.jpg'),
('Filedata[]', FieldStorage('Filedata[]', 'bornToBeWild1.jpg')),
('Upload', 'Submit Query')]}
Your flash uploader is designed to work with PHP and sends multiple Filedata[] fields (php interprets this as an array for easy access)
So you need to iterate and get them all:
def post(self):
for file_data in self.request.POST.getall('Filedata[]'):
logging.info(file_data.filename)
data should be file_data.value
Are you using the Django libraries available to you? If so, check this out.
Call self.request.POST.getall('Filename') to get a list of FieldStorage objects; each one contains one file. You can access the file data with .value, the name with .name, and the mimetype with .type.
I have no idea how that multi uploader works, I have made one in the past however and I just added a number on the end of input field name, then hide it. Then add a new file input field to add another file. The reason for this is that they don't let you play around with input file fields to much because you could make it upload files they didn't want you uploading.
Using my conventions, in your example the 2 files in your example would be "Filename0" and "Filename1". You could also use firebug to see what it renaming the input file fields to.
Edit: I had a look, and it's using flash. So i have no idea how it works.

Resources