Deepglint Metaloop Python SDK
Project description
Python SDK for Metaloop platform
Metaloop Python SDK is a python library to access Metaloop and manage your datasets. It provides:
- A pythonic way to access your Metaloop resources by Metaloop OpenAPI api.
Installation
pip install metaloop-python-sdk
Documentation
More information can be found on the examples
Usage
生成API Token
在登录平台后,点击页面右上角的用户名,在个人信息页面中,即可获取本用户的API Token
正式环境将http://192.168.100.71:30301 替换为 http://data.deepglint.com
操作数据集
import time
from metaloop.client import MDS
if __name__ == '__main__':
# use MDS("0c02ca70e142b75a75ca4118ce33dbb0", "http://192.168.100.71:30301") when connecting test-server
mds_client = MDS("0c02ca70e142b75a75ca4118ce33dbb0")
date_time = time.strftime("%Y%m%d%H%M%S", time.localtime())
dataset_name = f"test_dataset_{date_time}"
# create new dataset
dataset = mds_client.create_dataset(
dataset_name,
"image",
["screw"],
comment="this is a test dataset for mds"
)
# print dataset info
dataset.summary()
# get existed dataset
dataset = mds_client.get_dataset(dataset_name)
dataset.summary()
# create version
dataset.create_version(comment="this is a test version for mds")
dataset.summary()
# switch version
dataset.checkout(0)
dataset.summary()
# import local data to dataset
dataset.import_data("import_test/sample_test")
# accelerated when running on tencent cloud
dataset.import_data("import_test/sample_test", storage_type='cos')
# export data to local filesystem
dataset.export_data("export_test")
# delete version
dataset.delete_version(0)
dataset.summary()
# iter objects
for item in dataset:
print(item)
response = requests.get(item['obj_url'])
image = Image.open(BytesIO(response.content)).convert("RGB")
image.show()
# delete dataset
mds_client.delete_dataset(dataset_name)
dataset.summary()
Development
- CI pipeline
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
File details
Details for the file metaloop-python-sdk-1.25.0.tar.gz
.
File metadata
- Download URL: metaloop-python-sdk-1.25.0.tar.gz
- Upload date:
- Size: 38.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.9.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f95f818691f25ca713b622e00ba32be12e1e2dd74b87d4db815c0e351c997db4 |
|
MD5 | 1b7f8d2b2ecf890cf8f563c00f428aec |
|
BLAKE2b-256 | 038413d729f47f73088d63a3632e2855f9f66262d98b62a5152c8fe8c239414d |