Giter Site home page Giter Site logo

landmarkerio-server's Introduction

PyPI Release

The Menpo-powered landmarker.io server

About

landmarkerio server is an implementation of the landmarker.io server API in Python. It uses Menpo to load images and meshes and serves them to landmarker.io web clients for annotation. When the annotator is done, it is landmarkerio server that will actually persist the landmarks to disk.

The Python package for landmarkerio server is unambigously landmarkerio.

Purpose

landmarker.io knowns how to talk to landmarkerio server instances over a RESTful API. The server holds all assets and landmarks, and annotators can be constrained in what they can and can't do. For instance - you can limit the choice of templates that users are able to use, or the assets that they see. Upon saving, landmarks are saved back to the server instance, so at all times you remain in control of the annotation experiement.

Serving assets locally

landmarkerio server can be used for annotation jobs on a local machine, but it is not recommend. Consider using Landmarker.app instead.

If you do want to do local annoations with landmarkerio-server, just run the server (called lmio) from the command line. Your browser will automatically open to insecure.landmarker.io and you can start landmarking. See #17 for an indepth discussion on why this is on the 'insecure' subdomain.

You can get as clever as you want to enable remote serving of landmarks - SSH port tunnelling is an easy secure solution.

Installation

landmarkerio server requires Menpo Menpo3d to run. As these have somewhat complex dependencies, by far the easiest way to install landmarkerio, is with conda. On OS X, Linux or Windows, just install conda and then

>> conda install -c menpo landmarkerio

Important concepts

landmarkerio server handles three different forms of data

  • assets - meshes, textures and images
  • landmarks - annotations on assets
  • templates - specifications of landmarks

Usage

The landmarker.io server can be started in one of two modes: 'image' and 'mesh'. To begin annotating a folder of meshes, just run

>> lmio mesh ./path_to_meshes

To begin annotating a folder of images, run

>> lmio image ./path_to_images

You get help on the tool just as you would expect

>> lmio --help

Templates

Syntax

Templates restrict the set of allowed annotations and give the annotations semantic meaning. The user of the server has full control over what annotations the user of landmarker.io should complete by declaring templates. A template file is simple a .yml file. The filename is the name of the template.

An example template is provided below, a more detailed specification is also available on the landmarker.io wiki.

face.yaml

# groups key marks the template itself, anything else is metadata
groups:
  # The first landmark group is called 'mouth'
  # it is made up of six points
  - label: mouth
    points: 6
  - label: nose
    points: 3
    # Pairs of numbers immediately following a declaration
    # of a group specify connectivity information. Here,
    # The first entry of the nose group is joined to the second
    # (0-based indexing) and the second to the third. This will
    # be visualized in the landmarker.
    connectivity:
      - 0 1
      - 1 2
  - label: left_eye
    points: 8
    connectivity:
      # Slice notation is abused to construct straight chains
      # of connectivity. This is expanded out into
      # 0 1
      # 1 2
      # ...
      # 6 7
      - 0:7
      - 7 0
  - label: right_eye
    points: 8
    # The cycle shortcut
    connectivity: cycle
  - label: chin
    points: 1

Storing templates

A collection of template files can be placed in a templates folder. A path to a folder can be provided as the -t argument to landmarkerio. If no argument is provided, lmio looks for the folder ~/.lmiotempates. This provides a convenient place to store frequently used templates.

landmarkerio-server's People

Contributors

evanjbowling avatar gcowley1 avatar jabooth avatar lirsacc avatar patricksnape avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

landmarkerio-server's Issues

warning should be raised (or error?) on trying to handle images larger than 4096

We current scale users images which have a width or height greater than 4096 and don't even tell them, which leads to scale errors on annotations. This is a bug and we need a strategy to solve it. In order of increasing difficulty:

  1. Require a flag (--resize-images) to be explicitly provided by the user to allow the downscale to take place. Else, fail on importing large images. Very easy to do but means users can't practically use the landmarker with large textures.
  2. Track the downscale that was applied on import, and on the server side correct landmarks that are being saved. This means the client is blissfully unaware of the scaling, which is good (KISS) but bad as we ultimately want to make the client a standalone tool that is less dependent on server magic.
  3. Adapt the client so that it is able to do the resizing itself. This is ideally what we would like to do as it is the best solution for a future where the client is standalone - working on for instance local assets.

dependency on libGL (menpo3d -> CyRasterize)

Just trying to get landmarkerio-server running on a fresh VM of 14.04 and we hit an error after

conda install -c menpo/channel/master landmarkerio
Traceback (most recent call last):
  File "/home/jab08/miniconda/envs/lmio/bin/lmio", line 6, in <module>
    from landmarkerio.cache import cache_assets, filepath_as_asset_id_under_dir
  File "/home/jab08/miniconda/envs/lmio/lib/python2.7/site-packages/landmarkerio/cache.py", line 13, in <module>
    import menpo3d
  File "/home/jab08/miniconda/envs/lmio/lib/python2.7/site-packages/menpo3d/__init__.py", line 2, in <module>
    from . import rasterize
  File "/home/jab08/miniconda/envs/lmio/lib/python2.7/site-packages/menpo3d/rasterize/__init__.py", line 1, in <module>
    from .opengl import GLRasterizer
  File "/home/jab08/miniconda/envs/lmio/lib/python2.7/site-packages/menpo3d/rasterize/opengl.py", line 2, in <module>
    from cyrasterize.base import CyRasterizerBase
  File "/home/jab08/miniconda/envs/lmio/lib/python2.7/site-packages/cyrasterize/__init__.py", line 1, in <module>
    from cyrasterize.base import CyRasterizer
  File "/home/jab08/miniconda/envs/lmio/lib/python2.7/site-packages/cyrasterize/base.py", line 3, in <module>
    from cyrasterize.glrasterizer import GLRasterizer
ImportError: libGL.so.1: cannot open shared object file: No such file or directory

HTTP caching of all static assets

We should provide the correct headers in GET's of meshes to allow the browser to cache them for a long time - we have no expectation for them to change.

landmarkerio server installation

I have installed menpo and landmarkerio server using pip.

Now how to start the server ?

If I write lmio... it gives error of unrecognized command.

command line tool for serving meshes.

This server should be a script that can be run from the command line in a folder which will immediately serve meshes in the folder for annotation. It could also automatically open the browser for the user and point to landmarker.io, perhaps with a URL argument specifying the port and address that the landmarker should listen to.

Save Failed

I installed and ran the landmarker server and I have used ngrok to have a publicly available address. I tried both http://insecure.landmarker.io and https://www.landmarker.io and they were connected successfully to my landmarker server. However, when I was trying to save some landmarks, I got a 'save failed' message. Is this an issue about permissions in landmarks folder?

Sort the 'all' collection

Add a sorted call to the dirs_in_dir method so that the asset ordering for an automatic all collection is deterministic (and sensibly sorted lexicographically)

Unsatifiable error

I followed the instructions and installed conda as it says in the instructions. I now tried to install Menpo Menpo3d which is required by the landmarkerio server but I get the following error.
(base) C:\Users\aristides.abeywickra>conda install -c menpo landmarkerio Solving environment: failed

UnsatisfiableError: The following specifications were found to be in conflict:

  • landmarkerio
  • xlwings
    Use "conda info " to see the dependencies for each package.

AttributeError: 'CacheFile' object has no attribute 'startswith'

Following the installation directions, I installed via:

conda install -c menpo landmarkerio

then, navigating to the image folder,

lmio image ./test_images

which cases it to fail with a very large stack trace, the last error is:

...........................................................................
//anaconda/lib/python2.7/posixpath.pyc in join(a='/var/folders/qr/1vty98092csdq2ps0plxjrx000ck10/T/tmpIKPyVF/1691766_1.jpg', *p=(<CacheFile.image: 'image.json'>,))
     63     If any component is an absolute path, all previous path components
     64     will be discarded.  An empty last part will result in a path that
     65     ends with a separator."""
     66     path = a
     67     for b in p:
---> 68         if b.startswith('/'):
     69             path = b
     70         elif path == '' or path.endswith('/'):
     71             path +=  b
     72         else:

AttributeError: 'CacheFile' object has no attribute 'startswith'

OS is OS X Sierra. Conda is a fresh install (python 2.7.12).

~/.lmio/ configuration, default template.

Allow users to specify templates in a global config folder at '~/.lmio/templates/. In the event that the-tflag is not provided this folder will be used. If no folder is present and no-tflag passed,landmarkerio-server` will ship with a default set of templates that are used.

ImportError: libgfortran.so.1: cannot open shared object file: No such file or directory

I installed the landmarker-server (via conda install -c menpo landmarkerio) into a fresh conda environment and every time that I try to call lmio image [path_images] -t [path_template], I receive the following error:

ImportError: libgfortran.so.1: cannot open shared object file: No such file or directory

OS: Ubuntu 16.04 LTS

installed packages:

aniso8601                 0.82                     py27_0    menpo
apptools                  4.4.0                    py27_0    menpo
assimp                    3.0.1270                      0    menpo
cairo                     1.14.8                        0  
cherrypy                  3.8.0                    py27_0  
configobj                 5.0.6                    py27_0  
cyassimp                  0.2.2                    py27_0    menpo
cycler                    0.10.0                   py27_0  
cyrasterize               0.2.5                    py27_0    menpo
cyvlfeat                  0.4.5                    py27_0    menpo
envisage                  4.5.1                    py27_0    menpo
flask                     0.10.1                   py27_2  
flask-restful             0.2.12                   py27_0    menpo
fontconfig                2.12.1                        3  
freetype                  2.5.5                         2  
funcsigs                  0.4                      py27_0  
glew                      1.11.0                        0    menpo
glfw3                     3.0.4                         0    menpo
glib                      2.50.2                        1  
harfbuzz                  0.9.39                        2  
hdf5                      1.8.17                        1  
itsdangerous              0.24                     py27_0  
jbig                      2.1                           0  
jinja2                    2.9.4                    py27_0  
joblib                    0.8.4                    py27_0    menpo
jpeg                      8d                            2  
landmarkerio              0.4.1                    py27_0    menpo
libffi                    3.2.1                         1  
libgfortran               3.0.0                         1  
libiconv                  1.14                          0  
libpng                    1.6.27                        0  
libtiff                   4.0.6                         2  
libxml2                   2.9.4                         0  
markupsafe                0.23                     py27_2  
matplotlib                1.5.1               np110py27_0  
mayavi                    4.4.4                    py27_0    menpo
menpo                     0.6.2                    py27_0    menpo
menpo-pyvrml97            2.3.0a4                  py27_2    menpo
menpo3d                   0.3.0                    py27_0    menpo
mkl                       11.3.3                        0  
mock                      1.3.0                    py27_0  
nose                      1.3.7                    py27_1  
numpy                     1.10.4                   py27_2  
openblas                  0.2.14                        4  
openssl                   1.0.2k                        0  
pango                     1.40.3                        1  
pathlib                   1.0                      py27_1    menpo
pbr                       1.3.0                    py27_0  
pcre                      8.39                          1  
pillow                    3.0.0                    py27_1  
pip                       9.0.1                    py27_1  
pixman                    0.34.0                        0  
pycairo                   1.10.0                   py27_0  
pydispatcher              2.0.3                    py27_0    menpo
pyface                    5.1.0                    py27_0    menpo
pygments                  2.1.3                    py27_0  
pyparsing                 2.1.4                    py27_0  
pyqt                      4.11.4                   py27_4  
python                    2.7.13                        0  
python-dateutil           2.6.0                    py27_0  
pytz                      2016.10                  py27_0  
pyyaml                    3.11                     py27_4  
qt                        4.8.7                         4  
readline                  6.2                           2  
scipy                     0.16.0              np110py27_1  
setuptools                27.2.0                   py27_0  
simpleparse               2.1.1                    py27_0    menpo
sip                       4.18                     py27_0  
six                       1.10.0                   py27_0  
sqlite                    3.13.0                        0  
tk                        8.5.18                        0  
traits                    4.5.0                    py27_0    menpo
traitsui                  5.1.0                    py27_0    menpo
vlfeat                    0.9.20                        1    menpo
vtk                       7.0.0                    py27_0    menpo
werkzeug                  0.11.15                  py27_0  
wheel                     0.29.0                   py27_0  
xz                        5.2.2                         1  
yaml                      0.1.6                         0  
zlib                      1.2.8                         3  

Accessing landmarks which don't exist yields CORS error

image.js:50
XMLHttpRequest cannot load http://localhost:5000/api/v1/landmarks/max/ibug68. 
No 'Access-Control-Allow-Origin' header is present on the requested resource. 
Origin 'http://localhost:8080' is therefore not allowed access. 

pip install landmarkerio-server

Once #2 is complete a setup.py should be made so that the landmark server is pip installable and then runable from anywhere on the path.

Landmarker.io server down/unreachable

Hi !
I installed landmarkerio-server using pip in my menpo environment .
After typing lmio image folder -t template folder, it does some background running and then tries to open the server and ultimately I see a domain advertisement screen in my browser. I am afraid the server is unreacheable. Could you please look into it ? Thanks !
Tarana

2021-08-18 17:02:33.862 | DEBUG | landmarkerio.cache:ensure_cache_dir:180 - cache: /tmp/tmp8gv_v9uq
2021-08-18 17:02:33.863 | DEBUG | landmarkerio.cache:build_cache:230 - Using glob: "*"
2021-08-18 17:02:33.866 | DEBUG | landmarkerio.cache:build_cache:242 - 3 assets need to be added to the cache
[Parallel(n_jobs=-1)]: Using backend LokyBackend with 48 concurrent workers.
[Parallel(n_jobs=-1)]: Done 3 out of 3 | elapsed: 1.1s remaining: 0.0s
[Parallel(n_jobs=-1)]: Done 3 out of 3 | elapsed: 1.1s finished
2021-08-18 17:02:35.010 | DEBUG | landmarkerio.cache:build_cache:250 - 3 assets cached in 1 seconds
2021-08-18 17:02:35.013 | DEBUG | landmarkerio.landmark:init:119 - Landmarks served inplace - found 0 asset with landmarks
2021-08-18 17:02:35.015 | DEBUG | landmarkerio.template:init:155 - templates directory: removed
2021-08-18 17:02:35.017 | DEBUG | landmarkerio.template:init:180 - cached 0 templates ()
[2021-08-18 17:02:35 +0200] [37131] [INFO] Goin' Fast @ http://localhost:5000
[2021-08-18 17:02:35 +0200] [37131] [INFO] Starting worker [37131]

domain advertisement appears

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.