PaddleOCR icon indicating copy to clipboard operation
PaddleOCR copied to clipboard

paddler 疑似与其他模型冲突

Open RichardQin1 opened this issue 2 years ago • 4 comments

目标场景是使用paddle识别ocr结果 在另外的流程中使用modelscope的模型进行nlp分析。但似乎只要添加了from modelscope import pipeline, Tasks就报错。 注释掉就没问题。是否包冲突、有无解决优化和解决方案

  • 系统环境/System Environment:
conda install pytorch==2.0.1 torchvision==0.15.2 torchaudio==2.0.2 pytorch-cuda=11.8 -c pytorch -c nvidia
  • 版本号/Version:Paddle: PaddleOCR: 问题相关组件/Related components:
paddleocr               2.7.0.3
paddlepaddle-gpu        2.6.0
  • 运行指令/Command Code:
from paddleocr import PaddleOCR, draw_ocr
from modelscope import pipeline, Tasks

ocr = PaddleOCR(use_angle_cls=True, lang="ch") 

def get_ocr_content(ocr, video_path, start_time, end_time, name_list):
    video = cv2.VideoCapture(video_path)
    frame_count = int(video.get(cv2.CAP_PROP_FRAME_COUNT))  # 获取视频的总帧数
    fps = video.get(cv2.CAP_PROP_FPS)
    start_frame = int(start_time * fps)
    end_frame = int(end_time * fps)
    interval = 25  # 每25帧抽一帧
    for i in range(start_frame, end_frame, interval):
        video.set(cv2.CAP_PROP_POS_FRAMES, i)  # 设置到特定帧
        ret, frame = video.read()
        if not ret:  # 如果读取失败,跳过该帧
            continue
        result = ocr.ocr(frame, cls=True)  # 对当前帧进行OCR识别
        text = " "
        for idx in range(len(result)):
            res = result[idx]
            if res is None:
                continue
            for line in res:
                for name in name_list:
                    print(nlp.to_simplified_chinese(line[1][0]))
                    if name in nlp.to_simplified_chinese(line[1][0]):
                        return name
    return None

get_ocr_content(ocr, video_path, start, end, name_list)
  • 完整报错/Complete Error Message:
Traceback (most recent call last):
  File "/home/phoenix/python_project/funasr_test/ocr.py", line 33, in <module>
    name = get_ocr_content(ocr, video_path, start, end, name_list)
  File "/home/phoenix/python_project/funasr_test/videoOCR.py", line 23, in get_ocr_content
    result = ocr.ocr(frame, cls=True)  # 对当前帧进行OCR识别
  File "/home/phoenix/anaconda3/envs/funasr/lib/python3.8/site-packages/paddleocr/paddleocr.py", line 661, in ocr
    dt_boxes, rec_res, _ = self.__call__(img, cls)
  File "/home/phoenix/anaconda3/envs/funasr/lib/python3.8/site-packages/paddleocr/tools/infer/predict_system.py", line 99, in __call__
    img_crop_list, angle_list, elapse = self.text_classifier(
  File "/home/phoenix/anaconda3/envs/funasr/lib/python3.8/site-packages/paddleocr/tools/infer/predict_cls.py", line 111, in __call__
    self.predictor.run()
OSError: (External) CUBLAS error(15). 
  [Hint: 'CUBLAS_STATUS_NOT_SUPPORTED'.  The functionality requested is not supported ] (at /paddle/paddle/phi/kernels/funcs/blas/blas_impl.cu.h:41)
  [operator < fc > error]

我们提供了AceIssueSolver来帮助你解答问题,你是否想要它来解答(请填写yes/no)?/We provide AceIssueSolver to solve issues, do you want it? (Please write yes/no):yes

RichardQin1 avatar Jan 23 '24 14:01 RichardQin1

+1

gongel avatar Apr 25 '24 16:04 gongel

建议paddlepaddle-gpu版本安装老版本的:https://www.paddlepaddle.org.cn/install/old,这里推荐:python -m pip install paddlepaddle-gpu==2.3.2 -i https://pypi.tuna.tsinghua.edu.cn/simple ,新版本的问题比较多

jingsongliujing avatar Jun 17 '24 15:06 jingsongliujing

@jingsongliujing, 大佬,最好推荐用户使用最新版本的paddle。

GreatV avatar Jun 17 '24 15:06 GreatV

确实 paddle-gpu和pytorch冲突 反正不能一起用 2.4.2版本现在自身就有问题也不能用了

1443244362 avatar Jul 11 '24 06:07 1443244362