Skip to main content

LayerX Python SDK

Project description

layerx-python-sdk

LayerX Python API Client Sync (upload/download) with LayerX stacks via APIs from your local machine

You can

  • Upload model runs data

Installation

$ pip install layerx-sdk

Usage

import layerx  
  
api_key = 'xxxxxxxxxx' 
secret = 'xxxxxxxxxxx'
url = 'https://api.xxxx.layerx.ai'
  
client = layerx.LayerxClient(api_key, secret, url)  

collection_base_path = 'path1/path2/'
  
#upload box type annotations
file_path_bbox = '/home/bob/mydata/example_bbox.json' #local file path
client.upload_modelrun_from_json(collection_base_path, 'test model v1.0.1', file_path_bbox, 'rectangle')

#upload polygon type annotations
file_path_polygon = '/home/bob/mydata/example_polygon.json'
client.upload_modelrun_from_json(collection_base_path, 'test model v1.0.2', file_path_polygon, 'polygon')

#upload line type annotations
file_path_line = '/home/bob/mydata/example_line.json'
client.upload_modelrun_from_json(collection_base_path, 'test model v1.0.3', file_path_line, 'line')

Sample Data

Box Geometry

{
   "images":[
      {
         "image":"000000397133.jpg",
         "annotations":[
            {
               "bbox":[
                  217.62,
                  240.54,
                  38.99,
                  57.75
               ],
               "label":"kitchen",
               "metadata":{
                  "name":"bottle"
               },
               "confidence":0.30611335805442985
            }
         ]
      }
   ]
}

Polygon Geometry

{
   "images":[
      {
         "image":"000000397133.jpg",
         "annotations":[
            {
               "polygon":[
                  [
                     224.24,
                     297.18
                  ],
                  [
                     228.29,
                     297.18
                  ],
                  [
                     234.91,
                     298.29
                  ],
                  [
                     243.0,
                     297.55
                  ],
                  [
                     249.25,
                     296.45
                  ],
                  [
                     252.19,
                     294.98
                  ],
                  [
                     256.61,
                     292.4
                  ],
                  [
                     254.4,
                     264.08
                  ],
                  [
                     251.83,
                     262.61
                  ],
                  [
                     241.53,
                     260.04
                  ],
                  [
                     235.27,
                     259.67
                  ],
                  [
                     230.49,
                     259.67
                  ],
                  [
                     233.44,
                     255.25
                  ],
                  [
                     237.48,
                     250.47
                  ],
                  [
                     237.85,
                     243.85
                  ],
                  [
                     237.11,
                     240.54
                  ],
                  [
                     234.17,
                     242.01
                  ],
                  [
                     228.65,
                     249.37
                  ],
                  [
                     224.24,
                     255.62
                  ],
                  [
                     220.93,
                     262.61
                  ],
                  [
                     218.36,
                     267.39
                  ],
                  [
                     217.62,
                     268.5
                  ],
                  [
                     218.72,
                     295.71
                  ],
                  [
                     225.34,
                     297.55
                  ]
               ],
               "label":"kitchen",
               "metadata":{
                  "name":"bottle"
               },
               "confidence":0.8316836170368476
            }
         ]
      }
   ]
}

Line Geometry

{
   "images":[
      {
         "image":"000000397133.jpg",
         "annotations":[
            {
               "line":[
                  [
                     217.62,
                     240.54
                  ],
                  [
                     256.61,
                     240.54
                  ],
                  [
                     256.61,
                     298.28999999999996
                  ],
                  [
                     217.62,
                     298.28999999999996
                  ]
               ],
               "label":"kitchen",
               "metadata":{
                  "name":"bottle"
               },
               "confidence":0.9496247739008129
            }
         ]
      }
   ]
}

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

layerx-sdk-1.0.14.tar.gz (28.3 kB view details)

Uploaded Source

Built Distribution

layerx_sdk-1.0.14-py3-none-any.whl (34.7 kB view details)

Uploaded Python 3

File details

Details for the file layerx-sdk-1.0.14.tar.gz.

File metadata

  • Download URL: layerx-sdk-1.0.14.tar.gz
  • Upload date:
  • Size: 28.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.6

File hashes

Hashes for layerx-sdk-1.0.14.tar.gz
Algorithm Hash digest
SHA256 3291818707855e5a110655f56e1ed9e739b57b23a6d0c2aa46e6d6aba1eb677f
MD5 a45200f4225baceb08589871162c7a74
BLAKE2b-256 6082d1c822fe62e860c5ffdf8bc9f6084121044c66060f6dff72ca5f2b353956

See more details on using hashes here.

Provenance

File details

Details for the file layerx_sdk-1.0.14-py3-none-any.whl.

File metadata

  • Download URL: layerx_sdk-1.0.14-py3-none-any.whl
  • Upload date:
  • Size: 34.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.6

File hashes

Hashes for layerx_sdk-1.0.14-py3-none-any.whl
Algorithm Hash digest
SHA256 6f360315e50fd1902d67ab53a8c5b8dde416ab35379d226894e96dc3c8bef0af
MD5 6db1f28ada042dd4a7fa08abea0a4d32
BLAKE2b-256 90a4c1abf74edec32e9e2c5d557f5621079de83c1ea34c94eeddcee1c1da2a99

See more details on using hashes here.

Provenance

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page