解决pycococreatortools安装问题

我的环境:

python:3.8.18

numpy:1.24.4

问题一:

用git文档的方法下载失败:

复制代码
pip install git+git://github.com/waspinator/coco.git@2.1.0

解决:

用这行 pip install git+https://github.com/waspinator/pycococreator.git

问题二:使用pycococreatortools.binary_mask_to_polygon的时候报错

ValueError: setting an array element with a sequence. The requested array has an inhomogeneous shape after 1 dimensions. The detected shape was (2,) + inhomogeneous part.

解决:

在这个函数定义内加上一行 contours=sorted(contours,key=lambda x: len(x),reverse=True)[0:1]

所有这些问题都在git的issue里有

https://github.com/waspinator/pycococreator/issues?page=1&q=is%3Aissue+is%3Aopen

相关推荐
曲幽2 小时前
FastAPI + PostgreSQL 实战:从入门到不踩坑,一次讲透
python·sql·postgresql·fastapi·web·postgres·db·asyncpg
用户8356290780517 小时前
使用 C# 在 Excel 中创建数据透视表
后端·python
码路飞10 小时前
FastMCP 实战:一个 .py 文件,给 Claude Code 装上 3 个超实用工具
python·ai编程·mcp
dev派12 小时前
AI Agent 系统中的常用 Workflow 模式(2) Evaluator-Optimizer模式
python·langchain
前端付豪14 小时前
AI 数学辅导老师项目构想和初始化
前端·后端·python
用户03321266636714 小时前
将 PDF 文档转换为图片【Python 教程】
python
悟空爬虫15 小时前
UV实战教程,我啥要从Anaconda切换到uv来管理包?
python
dev派15 小时前
AI Agent 系统中的常用 Workflow 模式(1)
python·langchain
明月_清风17 小时前
从“能用”到“专业”:构建生产级装饰器与三层逻辑拆解
后端·python
曲幽1 天前
数据库实战:FastAPI + SQLAlchemy 2.0 + Alembic 从零搭建,踩坑实录
python·fastapi·web·sqlalchemy·db·asyncio·alembic