FENet: Focusing Enhanced Network for Lane Detection 调试报错记录

本文记录了在调试FENet车道检测代码过程中遇到的五个问题,包括CUDA版本不匹配、缺失.nms_impl模块、.gitignore文件未找到、numpy版本导致的AttributeError以及多进程插值错误的解决方法。
摘要由CSDN通过智能技术生成

FENet: Focusing Enhanced Network for Lane Detection 调试报错记录

github项目链接

问题1:

指令:

(fenetv1) ws@sun:~$ python /home/ws/CoodWorkRun/FENet-v1/setup.py build develop

报错

RuntimeError: 
The detected CUDA version (9.1) mismatches the version that was used to compile
PyTorch (11.3). Please make sure to use the same CUDA versions.

解决办法:

# 命令行终端先修正CUDA环境变量
export CUDA_PATH=/usr/local/cuda-11.3
export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/usr/local/cuda-11.3/lib64
export PATH=${PATH}:/usr/local/cuda-11.3/bin
# 执行
python /home/ws/CoodWorkRun/FENet-v1/setup.py build develop

问题2:

指令:

(fenetv1) ws@sun:~$ python /home/ws/CoodWorkRun/FENet-v1/setup.py build develop

报错

# 1
ImportError: cannot import name 'nms_impl' from partially initialized module 'fenet.ops' (most likely due to a circular import) (/home/ws/CoodWorkRun/FENet-v1/fenet/ops/__init__.py)
# 2
copying build/lib.linux-x86_64-cpython-38/fenet/ops/nms_impl.cpython-38-x86_64-linux-gnu.so -> fenet/ops
error: could not create 'fenet/ops/nms_impl.cpython-38-x86_64-linux-gnu.so': No such file or directory

解决办法:

尝试手动将.so文件复制到目标目录
build/lib.linux-x86_64-cpython-38/fenet/ops/nms_impl.cpython-38-x86_64-linux-gnu.so 

问题3:

指令:

(fenetv2) ws@sun:~$ python /home/ws/CoodWorkRun/FENet-v1/main.py 

报错

Traceback (most recent call last):
  File "/home/ws/CoodWorkRun/FENet-v1/main.py", line 62, in <module>
    main()
  File "/home/ws/CoodWorkRun/FENet-v1/main.py", line 35, in main
    runner = Runner(cfg)
  File "/home/ws/CoodWorkRun/FENet-v1/fenet/engine/runner.py", line 29, in __init__
    self.recorder = build_recorder(self.cfg)
  File "/home/ws/CoodWorkRun/FENet-v1/fenet/utils/recorder.py", line 135, in build_recorder
    return Recorder(cfg)
  File "/home/ws/CoodWorkRun/FENet-v1/fenet/utils/recorder.py", line 51, in __init__
    self.cp_projects(self.work_dir)
  File "/home/ws/CoodWorkRun/FENet-v1/fenet/utils/recorder.py", line 68, in cp_projects
    with open('./.gitignore', 'r') as fp:
FileNotFoundError: [Errno 2] No such file or directory: './.gitignore'

解决办法:

# 1、使用cd命令更改当前工作目录到脚本所在的目录:
cd /home/ws/CoodWorkRun/FENet-v1
# 2、确认您已经在正确的目录中,可以使用pwd命令查看当前工作目录:
pwd

问题4:

指令:

(fenetv2) ws@sun:~$ python /home/ws/CoodWorkRun/FENet-v1/main.py 

报错

AttributeError: module 'numpy' has no attribute 'bool'.
`np.bool` was a deprecated alias for the builtin `bool`. To avoid this error in existing code, use `bool` by itself. Doing this will not modify any behavior and is safe. If you specifically wanted the numpy scalar type, use `np.bool_` here.
The aliases was originally deprecated in NumPy 1.20; for more details and guidance see the original release note at:
    https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations

解决办法:

# 这个问题是由于numpy的版本问题
# 1.22或者1.24都容易出现这个问题
# 所以我们需要将numpy换成1.23的版本
# 可以使用如下命令
pip install numpy==1.23.2

问题5:

指令:

(fenetv2) ws@sun:~$ python /home/ws/CoodWorkRun/FENet-v1/main.py 

报错

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "main.py", line 62, in <module>
    main()
  File "main.py", line 42, in main
    runner.train()
  File "/home/ws/CoodWorkRun/FENet-v1/fenet/engine/runner.py", line 128, in train
    self.validate()
  File "/home/ws/CoodWorkRun/FENet-v1/fenet/engine/runner.py", line 173, in validate
    metric = self.val_loader.dataset.evaluate(predictions,
  File "/home/ws/CoodWorkRun/FENet-v1/fenet/datasets/culane.py", line 157, in evaluate
    result = culane_metric.eval_predictions(output_basedir,
  File "/home/ws/CoodWorkRun/FENet-v1/fenet/utils/culane_metric.py", line 243, in eval_predictions
    results = p.starmap(culane_metric, zip(predictions, annotations,
  File "/home/ws/anaconda3/envs/fenetv2/lib/python3.8/multiprocessing/pool.py", line 372, in starmap
    return self._map_async(func, iterable, starmapstar, chunksize).get()
  File "/home/ws/anaconda3/envs/fenetv2/lib/python3.8/multiprocessing/pool.py", line 771, in get
    raise self._value
ValueError: Invalid inputs.

解决办法:

# fenet/utils/culane_metric.py 路径下interp函数修改如下:
def interp(points, n=50):
    if len(points) < 2:  # 至少需要2个点进行插值
        print("Not enough points for interpolation.")
        return np.array(points)

    x = [p[0] for p in points]
    y = [p[1] for p in points]

    try:
        # 尝试进行样条曲线拟合
        tck, u = splprep([x, y], s=0, k=min(3, len(points) - 1))
        u_new = np.linspace(0, 1, num=(len(u) - 1) * n + 1)
        out = splev(u_new, tck)
        return np.array(out).T  # 将输出转换为适当的形式
    except Exception as e:
        print(f"Error in spline interpolation: {e}")
        return np.array(points)  # 在错误情况下返回原始点
  • 10
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

1-0-1 C

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值