The aim of this demo project is to show how you can solve an image pattern recognition problem using PyBossa technology.
This demo uses Flickr as the backend for storing the photos, but you can use any other web server or service that gives you public access to the photos.
The project has five main files:
- project.json: a JSON file that describes the project.
- long_description.md: a Markdown file with a long description of the project.
- results.html: to query the produced results and show them on real-time.
- template.html: the task presenter where the user/volunteer will do the image pattern recognition.
- tutorial.html: a simple tutorial that explains how to do the image pattern recognition.
You need to install the pybossa-pbs. If you don't have a virtual environment, we recommend you to create one, and activate it:
$ virtualenv env
$ source env/bin/activate
Then, you can install pybossa-pbs:
$ pip install pybossa-pbs
Or if you prefer:
$ pip install -r requirements.txt
NOTE: Use this template with a PyBossa server version >=1.2.0.
Now that you've all the requirements installed in your system, you need a PyBossa account:
- Create an account in your PyBossa server (use Crowdcrafting if you want).
- Copy your API-KEY (you can find it in your profile page).
PyBossa-pbs command line tool can be configured with a config file in order to avoid typing the API-KEY and the server every time you want to take an action on your project. For this reason, we recommend you to actually create the config file. For creating the file, follow the next steps:
$ cd ~
$ editorofyourchoice .pybossa.cfg
That will create a file. Now paste the following:
[default]
server: http://yourpybossaserver.com
apikey: yourapikey
Save the file, and you are done! From now on, pybossa-pbs will always use the default section to run your commands.
Now that we've everything in place, creating the project is as simple as running this command:
$ pbs create_project
Now we can add some tasks. The project comes with two samples that you can use:
- flickr_tasks.csv: a CSV file with some tasks
- get_images.py: a script that will contact Flickr to create a JSON file with links to images
This is very simple too, thanks to pbs:
$ pbs add_tasks --tasks-file flickr_tasks.csv
You'll get a progress bar with the tasks being uploaded. Now your project has some tasks in the server to be processed by the volunteers.
Instead of giving you a JSON file, we wanted to show you how you can use a web service like Flickr to query it and get the images that want to do image pattern recognition. For this reason, we've created the script get_images.py.
When you run this script, it will contact Flickr, get the last 20 published photos in the web services, get its links, and write a file in JSON format named: flickr_tasks.json. We'll use this file to add some extra tasks to our project:
$ python get_images.py
$ pbs add_tasks --tasks-file flickr_tasks.json
Again, as before, you will see a progess bar as the tasks are being added to your project. You can modify get_images.py to adapt it for your needs ;-)
Now that we've some data to process, let's add to our project the required templates to show a better description of our project, to present the tasks to our users, and a small tutorial for the volunteers:
$ pbs update_project
Done! Now you can do image pattern recognition problems in the PyBossa server.
NOTE: we provide templates also for Bootstrap v2 in case your PyBossa server is using Bootstrap2 instead of Bootstrap3. See the rest of the files.
In order to get real-time analysis, you will need to set up your own server using our webhooks micro-service. Check the project for more information.
Once you have your server running, paste your IP in the webhook section of your project.
For debugging, use the project webhooks section, where you will be able to re-run the same payload without asking your volunteers to repeat it ;-)
We recommend that you read the section: Build with PyBossa, follow the step by step tutorial and read the PyBossa pbs documentation.
NOTE: This project uses the pybossa-pbs library in order to simplify the development of the project and its usage. Check the documentation.
Copyright (C) 2015 SciFabric LTD
Please, see the COPYING file.
The thumbnail has been created using a photo from DncnH (license CC BY 2.0).
Note: You can see the results of the Crowdcrafting project here