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.24.1.tar.gz
.
File metadata
- Download URL: metaloop-python-sdk-1.24.1.tar.gz
- Upload date:
- Size: 38.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.9.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c1693a3005128d146c7f9d29fc29a5702bf2b7fad4b3a92198bad51aff21b91a |
|
MD5 | 33861c34333dd2b2dafd01c3011fe5b9 |
|
BLAKE2b-256 | d83498bf0ade6c51d01223929da29e07722f5370fae2f19cbf8a8eed891f8bc8 |