安装错误_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

相关文章

ESP32 esp-idf esp-adf环境安装及.a库创建与编译

简介 ESP32 功能丰富的 Wi-Fi & 蓝牙 MCU, 适用于多样的物联网应用。使用freertos操作系统。 ESP-IDF 官方物联网开发框架。 ESP-ADF 官方音频开发框架。 文档参照 https://espressif-docs.readthedocs-hosted.com/projects/esp-adf/zh-cn/latest/get-started/index

Linux 安装、配置Tomcat 的HTTPS

Linux 安装 、配置Tomcat的HTTPS 安装Tomcat 这里选择的是 tomcat 10.X ,需要Java 11及更高版本 Binary Distributions ->Core->选择 tar.gz包 下载、上传到内网服务器 /opt 目录tar -xzf 解压将解压的根目录改名为 tomat-10 并移动到 /opt 下, 形成个人习惯的路径 /opt/tomcat-10

C++工程编译链接错误汇总VisualStudio

目录 一些小的知识点 make工具 可以使用windows下的事件查看器崩溃的地方 dumpbin工具查看dll是32位还是64位的 _MSC_VER .cc 和.cpp 【VC++目录中的包含目录】 vs 【C/C++常规中的附加包含目录】——头文件所在目录如何怎么添加,添加了以后搜索头文件就会到这些个路径下搜索了 include<> 和 include"" WinMain 和

VMware9.0详细安装

双击VMware-workstation-full-9.0.0-812388.exe文件: 直接点Next; 这里,我选择了Typical(标准安装)。 因为服务器上只要C盘,所以我选择安装在C盘下的vmware文件夹下面,然后点击Next; 这里我把√取消了,每次启动不检查更新。然后Next; 点击Next; 创建快捷方式等,点击Next; 继续Cont

vcpkg安装opencv中的特殊问题记录(无法找到opencv_corexd.dll)

我是按照网上的vcpkg安装opencv方法进行的(比如这篇:从0开始在visual studio上安装opencv(超详细,针对小白)),但是中间出现了一些别人没有遇到的问题,虽然原因没有找到,但是本人给出一些暂时的解决办法: 问题1: 我在安装库命令行使用的是 .\vcpkg.exe install opencv 我的电脑是x64,vcpkg在这条命令后默认下载的也是opencv2:x6

【服务器运维】CentOS6 minimal 离线安装MySQL5.7

1.准备安装包(版本因人而异,所以下面的命令中版本省略,实际操作中用Tab自动补全就好了) cloog-ppl-0.15.7-1.2.el6.x86_64.rpmcpp-4.4.7-23.el6.x86_64.rpmgcc-4.4.7-23.el6.x86_64.rpmgcc-c++-4.4.7-23.el6.x86_64.rpmglibc-2.12-1.212.el6.x86_64.r

【服务器运维】CentOS7 minimal 离线安装 gcc perl vmware-tools

0. 本机在有网的情况下,下载CentOS镜像 https://www.centos.org/download/ 1. 取出rpm 有的情况可能不需要net-tools,但是如果出现跟ifconfig相关的错误,就把它安装上。另外如果不想升级内核版本的话,就找对应内核版本的rpm版本安装 perl-Time-Local-1.2300-2.el7.noarch.rpmperl-Tim

Windows/macOS/Linux 安装 Redis 和 Redis Desktop Manager 可视化工具

本文所有安装都在macOS High Sierra 10.13.4进行,Windows安装相对容易些,Linux安装与macOS类似,文中会做区分讲解 1. Redis安装 1.下载Redis https://redis.io/download 把下载的源码更名为redis-4.0.9-source,我喜欢跟maven、Tomcat放在一起,就放到/Users/zhan/Documents

Ubuntu20.04离线安装Docker

1.下载3个docker离线安装包,下载网址: https://download.docker.com/linux/ubuntu/dists/xenial/pool/stable/amd64/ 2.把3个离线安装包拷贝到ubuntu本地执行以下命令 sudo dpkg -i containerd.io_1.4.6-1_amd64.deb sudo dpkg -i docker-ce-c

Windows中,.net framework 3.5安装

安装.net framework,目前已知2种方法,如下: 一、在MSDN下载对应的安装包,安装,这种可能无法安装成功,概率很大,不成功使用第二种方法,基本上没问题。 二、win8/8.1/10 下安装 .net framework 3.5.1: 1. 打开 win8/8.1/10 安装盘(这里指系统安装镜像文件),提取 sources\sxs 文件夹到 X:\sources\sxs (X代