安装:
pip install long-utils
图像
图中找图
from long_utils.image.search import ImgFindImg
img = ImgFindImg(img_source='static/big.png', img_search='static/small.png')
img.find_coord(is_debug=True)
# 或者只拿取小图在原图中的坐标rectangle, 小图在原图中的大小result,confidence表示准确率
res = img.find_coord()
# [{'result': (539.0, 21.5), 'rectangle': ((524, 10), (524, 33), (554, 10), (554, 33)), 'confidence': 1.0}]
print(res)
其他
日志输出
from long_utils import Log
logger = Log(show_line=True, show_file_name=True, show_time=True)
logger.error(message="xxxx")
logger.success(message="xxxx")
logger.warning(message="xxxx")
logger.info(message="xxxx")
logger.debug(message="xxxx")
logger.success_bg('xxxx')
logger.error_bg('xxxx')
logger.warning_bg('xxxx')
logger.debug_bg('xxxx')
logger.info_bg('xxxx')
logger.color('xxxx', fg='blue', bg='black')
对象存储OSS
配置
from long_utils.storage.config import SSconfig
from long_utils.storage.aliyun.oss import AliyumOss
access_key = 'xxx'
access_key_secret = 'xxx'
endpoint = 'https://oss-cn-shanghai.aliyuncs.com'
bucket_name = 'xxx'
ss_config = SSconfig(
access_key_id=access_key,
access_key_secret=access_key_secret,
bucket_url=endpoint,
bucket_name=bucket_name
)
aliyun_client = AliyumOss(
config=ss_config
)
分片下载文件到本地
aliyun_client.multipart_upload_file(key='xxx.pth', local_file='xxx.pth')
如果需要知道下载进度,可以:
def progress_callback(block_size, total_size):
print(f"正在下载: {block_size / total_size * 100:.2f}%")
aliyun_client.multipart_upload_file(key='xxx.pth', local_file='xxx.pth', progress_callback=progress_callback)
分片上传本地文件
aliyun_client.multipart_upload_file(key='xxx.pth', file='xxxx.pth')
如果需要知道上传进度,可以:
def progress_callback(block_size, total_size):
print(f"正在上传: {block_size / total_size * 100:.2f}%")
aliyun_client.multipart_upload_file(key='xxx.pth', file='xxx.pth', progress_callback=progress_callback)
Metadata
Release files for long-utils 0.7.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| long-utils-0.7.2.tar.gz | 12.1 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| long_utils-0.7.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 31.1 kB
Release files / long-utils-0.7.2.tar.gz
| Download URL | long-utils-0.7.2.tar.gz |
|---|---|
| Size | 12.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
e017c986edcef2e073cae9eafcda6220ef7369e706cb291d7507f6d64921309b
|
|
BLAKE2b-256 checksum How to use checksums |
3eec4da35d7ddf1cdcec26a730b274bbaa4f0a700770051391bacbc2c91d0331
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.7.5
|
Release files / long_utils-0.7.2-py3-none-any.whl
| Download URL | long_utils-0.7.2-py3-none-any.whl |
|---|---|
| Size | 19.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
02dac862f01553010a94732883015a674fbe5a75c4cc9ccf31cac4926b8471f7
|
|
BLAKE2b-256 checksum How to use checksums |
066de306539ff4e852e06833a6f22f09d57d29801891cb86d1b37d8ec0f1a0b0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.7.5
|
Security for long-utils 0.7.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.