安装错误_ImportError: cannot import name ‘XXX‘循环引用 绕晕TT(deepsolo)

本文主要是介绍安装错误_ImportError: cannot import name ‘XXX‘循环引用 绕晕TT(deepsolo),希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

这里写目录标题

    • error: Couldn't find a setup script in /tmp/easy_install-lfpvj6p4/scikit_image-0.22.0.tar.gz
    • pip install -v -e . 和 python setup.py develop功能一样吗
    • AttributeError: module ‘PIL.Image’ has no attribute ‘LINEAR’
    • ImportError: cannot import name 'string_metric' from 'rapidfuzz'
    • 循环引用、调包死锁
    • -bash: syntax error near unexpected token `newline'问题解决
    • evaluation(deepsolo)
      • config和modle如果不匹配
    • SyntaxError: EOL while scanning string literal
    • ModuleNotFoundError: No module named 'pytorch_lightning'
    • ModuleNotFoundError: No module named 'lmdb'
    • No module named 'pytorch_lightning.strategies'
    • 注意:千万不要手欠去修改源码
    • Set the environment variable HYDRA_FULL_ERROR=1 for a complete stack trace.
    • ncclInvalidUsage: This usually reflects invalid usage of NCCL library (such

error: Couldn’t find a setup script in /tmp/easy_install-lfpvj6p4/scikit_image-0.22.0.tar.gz

python setup.py build develop

这行代码报错,按以下代码查看python setup.py后面接什么

python setup.py --help-commands

发现build develop是分别两个功能
python setup.py build 没问题
python setup.py develop包上面的错

没法解决,发现
pip3 install -v -e .

python3 setup.py develop
好像功能相同,于是用上面那条安装了

后来重新python setup.py develop也不报错了

pip install -v -e . 和 python setup.py develop功能一样吗

pip3 install -v -e .

python3 setup.py develop
一个作用吗?

AttributeError: module ‘PIL.Image’ has no attribute ‘LINEAR’

安装低版本pillow,新版本取消了LINEAR参数。

#pillow包与torchvision的版本不匹配,降级pillow解决

pip uninstall pillow

pip install pillow==9.0.1 --no-cache-dir
降低pillow版本即可

ImportError: cannot import name ‘string_metric’ from ‘rapidfuzz’

该错误通常是由于安装的 rapidfuzz 版本过低导致的
pip uninstall rapidfuzz
pip install rapidfuzz
升级了还不行

循环引用、调包死锁

debug到眼睛即将瞎掉
在这里插入图片描述
解决方案就是
在这里插入图片描述
用的是解法一,解法1:直接导入模块名,通过模块调用其中的函数

显然,有两个module,一个是adet.evaluation,一个是adet.evaluation.text_evaluation_all

helpful!!! python解决循环引用问题

python中,每个py文件被称之为模块,每个具有__init__.py文件的目录被称为包.只要模块或者包所在的目录在sys.path中,就可以使用import 模块或import 包来使用.可以通过以下方式查看导入路径.
1、ImportError: cannot import name ‘XXX‘ 问题最全解最根本决方案 [循环引用](确实挺全的,主要解决的方法还是上面那个链接,这篇多加了个建议优化代码结构!
2、ImportError :cannot import name xxxxxx 的三种类型的解决方法,给出了具体循环调用的例子,比我遇到的其实要复杂,全路径这种方法在我这儿不work,实用价值不大,用于理解循环调用

3、Python的from和import用法,没有太明白,大概
from math import pi ,pi是包含在math 模块里的东西

是我错

from adet.evaluation import text_eval_script
from adet.evaluation import text_eval_script_ic15
# import adet.evaluation

这样可以避免,导入text_eval_script.py两个文件,真正的错误在这两个文件里,
注释掉from rapidfuzz import string_metric就好了
主要就是这条语句出错,看了一下 rapidfuzz的_init_ .py文件,根本没有string_metric这个函数或者是什么别的东西
学到的,import的可能是个py文件,逐层import, 最终应该是某个py文件里的function

最终!!!!!!
rapidfuzz包版本过高
解决方式:降低该包版本为1.1.1版本

pip install rapidfuzz==1.1.1

吐血了!!!!

-bash: syntax error near unexpected token `newline’问题解决

原因:bash语法错误,例如,

仔细查看发现语句中不能有’<‘和’>',删除这两个符号即可:

evaluation(deepsolo)

python tools/train_net.py --config-file ${CONFIG_FILE} --eval-only MODEL.WEIGHTS ${MODEL_PATH}

$ {CONFIG_FILE} 直接换成绝对路径就好,$ { } $ 是不用保留的TT

例如


python tools/train_net.py --config-file configs/R_50/TotalText/finetune_150k_tt_mlt_13_15.yaml --eval-only MODEL.WEIGHTS work_dirs/tt_res50_finetune_synth-tt-mlt-13-15.pth

在这里插入图片描述

python demo/demo.py --config-file configs/R_50/TotalText/finetune_150k_tt_mlt_13_15.yaml --input datasets/ocr_en_422k --output output/ocr_en --opts MODEL.WEIGHTS work_dirs/tt_res50_finetune_synth-tt-mlt-13-15.pth
python demo/demo.py --config-file configs/R_50/TotalText/finetune_150k_tt_mlt_13_15.yaml --input datasets/ocr_zh_230920_381k --output output/ocr_zh --opts MODEL.WEIGHTS work_dirs/tt_res50_finetune_synth-tt-mlt-13-15.pth

分界线(89.6)

python demo/demo.py --config-file configs/ViTAEv2_S/TotalText/finetune_150k_tt_mlt_13_15_textocr.yaml --input datasets/ocr_en_422k --output output/ocr_en --opts MODEL.WEIGHTS work_dirs/tt_vitaev2-s_finetune_synth-tt-mlt-13-15-textocr.pth

在这里插入图片描述
中英文混合图片里有时候识别过度

python demo/demo.py --config-file configs/ViTAEv2_S/TotalText/finetune_150k_tt_mlt_13_15_textocr.yaml --input datasets/ocr_zh_230920_381k --output output/ocr_zh --opts MODEL.WEIGHTS work_dirs/tt_vitaev2-s_finetune_synth-tt-mlt-13-15-textocr.pth
python demo/demo.py --config-file configs/R_50/TotalText/finetune_150k_tt_mlt_13_15.yaml --input datasets/ocr_zh_230920_381k --output output/ocr_zh --opts MODEL.WEIGHTS work_dirs/tt_vitaev2-s_finetune_synth-tt-mlt-13-15-textocr.pth

无法识别中文,这块模块搭配错了好像,中英文混合 连英文都识别不了

config和modle如果不匹配

python demo/demo.py --config-file configs/R_50/TotalText/finetune_150k_tt_mlt_13_15.yaml  --input datasets/ocr_en_422k --output output/ocr_en --opts MODEL.WEIGHTS work_dirs/tt_vitaev2-s_finetune_synth-tt-mlt-13-15-textocr.pth

在这里插入图片描述

python demo/demo.py --config-file configs/R_50/TotalText/finetune_150k_tt_mlt_13_15.yaml  --input datasets/ocr_en_422k --output output/ocr_en --opts MODEL.WEIGHTS work_dirs/tt_vitaev2-s_finetune_synth-tt-mlt-13-15-textocr.pth

无法识别!!!
"/data1/xyj/DeepSolo-main/datasets/ocr_zh_230920_381k/"
主要是识别中文的,英文识别功能差一点
在这里插入图片描述
英文数据集上,中文可以精准识别,但是英文差点

python demo/demo.py --config-file configs/ViTAEv2_S/ReCTS/finetune.yaml --input datasets/ocr_en_422k --output output/ocr_en --opts MODEL.WEIGHTS work_dirs/rects_vitaev2-s_finetune.pth

中文数据集上

python demo/demo.py --config-file configs/ViTAEv2_S/ReCTS/finetune.yaml --input datasets/ocr_zh_230920_381k --output output/ocr_zh --opts MODEL.WEIGHTS work_dirs/rects_vitaev2-s_finetune.pth

在这里插入图片描述
中英文都可以,但是被遮挡一半的文字 表现不太好
configs/ViTAEv2_S/ReCTS/finetune.yaml

SyntaxError: EOL while scanning string literal

检查代码:

1、是否有单引号、双引号、或三引号没有闭合(‘’只有开头没有闭合)。
2、如果是多行字符串需要使用三引号。单引号、双引号、引起来的字符串文字不能跨越多行

ModuleNotFoundError: No module named ‘pytorch_lightning’

PyTorch Lightning安装

ModuleNotFoundError: No module named ‘lmdb’

just pip install

No module named ‘pytorch_lightning.strategies’

https://github.com/Lightning-AI/pytorch-lightning/discussions/11664

pytorch_lightning.strategies will be available in v1.6 release and is only available in master at the moment.
安装1.6.0版本的pytorch_lightning

注意:千万不要手欠去修改源码

正确解决方案:更换版本

Set the environment variable HYDRA_FULL_ERROR=1 for a complete stack trace.

设置方法:直接在python指令前加HYDRA_FULL_ERROR=1就可以
HYDRA_FULL_ERROR=1 python foo.py

 export HYDRA_FULL_ERROR=1python foo.py

ncclInvalidUsage: This usually reflects invalid usage of NCCL library (such

这个机器只有两张卡,但是我在另一台机器跑过四张卡的,修改即可。我的情况是–num-gpus 8,可是没有8张卡

python projects/SWINTS/train_net.py --num-gpus 4 --config-file projects/SWINTS/configs/SWINTS-swin-pretrain.yaml

python demo/demo.py
–config-file projects/SWINTS/configs/SWINTS-swin-finetune-totaltext.yaml
–input datasets/ocr_en_422k/*
–output output/ocr_en
–confidence-threshold 0.4
–opts MODEL.WEIGHTS work_dirs/swin_imagenet_pretrain.pth

这篇关于安装错误_ImportError: cannot import name ‘XXX‘循环引用 绕晕TT(deepsolo)的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/452887

相关文章

JAVA中安装多个JDK的方法

《JAVA中安装多个JDK的方法》文章介绍了在Windows系统上安装多个JDK版本的方法,包括下载、安装路径修改、环境变量配置(JAVA_HOME和Path),并说明如何通过调整JAVA_HOME在... 首先去oracle官网下载好两个版本不同的jdk(需要登录Oracle账号,没有可以免费注册)下载完

Java JDK1.8 安装和环境配置教程详解

《JavaJDK1.8安装和环境配置教程详解》文章简要介绍了JDK1.8的安装流程,包括官网下载对应系统版本、安装时选择非系统盘路径、配置JAVA_HOME、CLASSPATH和Path环境变量,... 目录1.下载JDK2.安装JDK3.配置环境变量4.检验JDK官网下载地址:Java Downloads

SQL server数据库如何下载和安装

《SQLserver数据库如何下载和安装》本文指导如何下载安装SQLServer2022评估版及SSMS工具,涵盖安装配置、连接字符串设置、C#连接数据库方法和安全注意事项,如混合验证、参数化查... 目录第一步:打开官网下载对应文件第二步:程序安装配置第三部:安装工具SQL Server Manageme

linux解压缩 xxx.jar文件进行内部操作过程

《linux解压缩xxx.jar文件进行内部操作过程》:本文主要介绍linux解压缩xxx.jar文件进行内部操作,具有很好的参考价值,希望对大家有所帮助,如有错误或未考虑完全的地方,望不吝赐教... 目录一、解压文件二、压缩文件总结一、解压文件1、把 xxx.jar 文件放在服务器上,并进入当前目录#

SpringBoot+Docker+Graylog 如何让错误自动报警

《SpringBoot+Docker+Graylog如何让错误自动报警》SpringBoot默认使用SLF4J与Logback,支持多日志级别和配置方式,可输出到控制台、文件及远程服务器,集成ELK... 目录01 Spring Boot 默认日志框架解析02 Spring Boot 日志级别详解03 Sp

Python中win32包的安装及常见用途介绍

《Python中win32包的安装及常见用途介绍》在Windows环境下,PythonWin32模块通常随Python安装包一起安装,:本文主要介绍Python中win32包的安装及常见用途的相关... 目录前言主要组件安装方法常见用途1. 操作Windows注册表2. 操作Windows服务3. 窗口操作

Java中的for循环高级用法

《Java中的for循环高级用法》本文系统解析Java中传统、增强型for循环、StreamAPI及并行流的实现原理与性能差异,并通过大量代码示例展示实际开发中的最佳实践,感兴趣的朋友一起看看吧... 目录前言一、基础篇:传统for循环1.1 标准语法结构1.2 典型应用场景二、进阶篇:增强型for循环2.

Python循环结构全面解析

《Python循环结构全面解析》循环中的代码会执行特定的次数,或者是执行到特定条件成立时结束循环,或者是针对某一集合中的所有项目都执行一次,这篇文章给大家介绍Python循环结构解析,感兴趣的朋友跟随... 目录for-in循环while循环循环控制语句break语句continue语句else子句嵌套的循

gitlab安装及邮箱配置和常用使用方式

《gitlab安装及邮箱配置和常用使用方式》:本文主要介绍gitlab安装及邮箱配置和常用使用方式,具有很好的参考价值,希望对大家有所帮助,如有错误或未考虑完全的地方,望不吝赐教... 目录1.安装GitLab2.配置GitLab邮件服务3.GitLab的账号注册邮箱验证及其分组4.gitlab分支和标签的

MySQL MCP 服务器安装配置最佳实践

《MySQLMCP服务器安装配置最佳实践》本文介绍MySQLMCP服务器的安装配置方法,本文结合实例代码给大家介绍的非常详细,对大家的学习或工作具有一定的参考借鉴价值,需要的朋友参考下... 目录mysql MCP 服务器安装配置指南简介功能特点安装方法数据库配置使用MCP Inspector进行调试开发指