Part of trees/ungp.
This is a street-level image segmentation algorithm hosted on the methods.officialstatistics.org Algorithmia platform.
The implementation (currently) makes use of a Chainer implementation of a Pyramid Scene Parsing Network (PSPNet) which has been included as a git submodule.
Please see example code in src/client.
The algorithm accepts 2 arguments: src and dst.
Where:
src: The (Algorithmia hosted) location of.jpgimages you wish to segment. For example:data://.my/input_imagesdst: The (Algorithmia hosted) location to store the segmentation results. For example:data://.algo/nocturne/segment/temp.
Note that it is good practice to store results in
data://.algo/:user/:algo/tempsince these files will be automatically deleted
by the algorithmia platform once per day.
After running, check the dst directory for resulint .bmp images.
The .bmp images describe the predicted segments for each pixel in the scene.
Each pixel value will range between 0 and 255 and map to a specific label.
The current implementation makes use of a network pre-trained on the Cityscapes
dataset, and as such, the labels are as follows:
- road
- sidewalk
- building
- wall
- fence
- pole
- traffic light
- traffic sign
- vegetation
- terrain
- sky
- person
- rider
- car
- truck
- bus
- train
- motorcycle
- bicycle
Please see the src/client/visualise.py code for a complete post-processing demo.
See src/client/exmaple.py for an end-to-end Python based demo.
Else, the webservice can be invoked as follows:
Set credentials
export API_KEY="xxx"
export VERSION=$(git rev-parse HEAD)
Using curl:
curl -X POST -d '{"images":["x"]}' -H 'Content-Type: text/json' \
-H 'Authorization: Simple $API_KEY' \
https://api.methods.officialstatistics.org/v1/algo/nocturne/segment/$VERSION
Using the Algorithmia algo client:
algo run nocturne/segment/$(git rev-parse HEAD) -d \
'{"src": "data://.my/test_images", "dst": "data://.my/out"}'
make test
