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
metaloop-python-sdk-1.24.0.tar.gz
(38.4 kB
view hashes)
Close
Hashes for metaloop-python-sdk-1.24.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0463699dd0ac87ef15aeb4daf2e0696618855ae44033bdee0b5259933f498d61 |
|
MD5 | 1737a09225f466bd43c1816ab68764e2 |
|
BLAKE2b-256 | eb2b62ae9b7c1ac6c9e6ebe866a65fffb323268fbe3626905ade39d6cffbdc9b |