• 小bugs搜集和解决方法,亲测有效(2022-2023)


    有些小bugs几行指令就能解决,写太多不好,这里就进行一个2022-2023这段时间的bugs collection和solution。

    Deep Learning

    How to make really empty tensor?

    a = nn.Torch([])
    b = torch.empty(2,3)
    for i in rang(3):
    	a = torch.cat(a, b, dim=0)
    
    • 1
    • 2
    • 3
    • 4

    Mismatched attribute type in ’ : value’ ==> Context: Bad node spec for node. Name: OpType: Constant

    pip uninstall onnx; pip install onnx==1.11
    
    • 1

    参考:
    onnx
    Try running yolov3_onnx sample

    Can’t pickle local object 'MiniImagenet.init..

    windows不支持:
    No, it is not supported on Windows. The reason is that multiprocessing lib doesn’t have it implemented on Windows. There are some alternatives like dill that can pickle more objects.
    类似问题:

    Can’t pickle local object ‘DataLoader.__init__.<locals>.<lambda>'
    
    • 1

    参考资料:
    Can’t pickle local object ‘DataLoader.init..’

    error: Microsoft Visual C++ 14.0 or greater is required.

    windows上安装detectron2出现了这个问题。

    error: Microsoft Visual C++ 14.0 or greater is required. Get it with "Microsoft C++ Build Tools": https://visualstudio.microsoft.com/visual-cpp-build-tools/
    
    • 1

    解决办法是卸载visual studio然后安装最新版。

    Google colab自动断连

    Never use google colab!!!
    亚洲地区不适用,别用,会断连。

    Python 3.11 + pytorch in win11 has error

    Use python 3.10.

    Freeze layer bugs

    Model.named_parameters()会忽略掉一些参数,比如:

    Conv1.Bn.running_mean
    Conv1.Bn.running_var 
    Conv1.Bn.num_batches_tracked
    
    • 1
    • 2
    • 3

    解决方法,用model.state_dict():

    for k, v in model.state_dict().items():
        print k
        print type(v)
    
    • 1
    • 2
    • 3

    参考资料:
    Model.named_parameters() will lose some layer modules

    Prediction mask is black

    Mean and std should be assigned to avoid bias.

    Some coco validation image does not have label

    在这里插入图片描述

    Python

    Import “imgaug.augmenters” could not be resolved PylancereportMissingImports

    解决方法:

    conda install imgaug
    
    • 1

    Cannot import name ‘_registerMatType’ from ‘cv2.cv2’ #1494

    在cmd等命令窗口卸载imagua。Uninstall imagua in user folder by cmd.

    pip uninstall imagua
    
    • 1

    The frame append method is deprecated use pandas.concat instead

    self.F1ScoreDF = self.F1ScoreDF.append(pd.DataFrame(TCnn.F1Score).T)
    
    • 1

    改成

    self.F1ScoreDF = pd.concat([self.F1ScoreDF, pd.DataFrame(TCnn.F1Score).T])
    
    • 1

    set_yticks does not show up

    Map类型的数据不要用来做label。It is nothing about figure size, but just the label names are stored by map object, which is unreasonable.

    ax.set_yticks(np.arange(data.shape[0]), labels=ClassNames)
    
    
    ClassNames = map(str.upper, opt.class_names)
    to
    ClassNames = list(map(str.upper, opt.class_names))
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6

    imgviz.instances2rgb ‘FreeTypeFont’ object has no attribute ‘getsize’

    出现:

    imgviz.instances2rgb 'FreeTypeFont' object has no attribute 'getsize'
    
    • 1

    解决办法downgrading pillow

    pip install "pillow==9.5.0" --force-reinstall
    
    • 1

    Anaconda

    OMP: Error #15: Initializing libiomp5md.dll, but found libiomp5md.dll already initialized.

    OMP: Hint This means that multiple copies of the OpenMP runtime have been linked into the program. That is dangerous, since it can degrade performance or cause 
    incorrect results. The best thing to do is to ensure that only a single OpenMP runtime is linked into the process, e.g. by avoiding static linking of the OpenMP runtime in any library. As an unsafe, unsupported, undocumented workaround you can set the environment variable KMP_DUPLICATE_LIB_OK=TRUE to allow the program 
    to continue to execute, but that may cause crashes or silently produce incorrect results. For more information, please see http://www.intel.com/software/products/support/.
    
    • 1
    • 2
    • 3

    解决方法:
    将mkl在anaconda得navigator删除。
    remove mkl in anaconda navigator。

    Anaconda libstdc++.so.6: version `GLIBCXX_3.4.20’ not found

    conda update libstdcxx-ng
    
    • 1

    参考资料:
    Anaconda libstdc++.so.6: version `GLIBCXX_3.4.20’ not found

    sklearn for conda

    conda install -c conda-forge scikit-learn
    
    • 1

    GitHub

    fatal: unable to access Connection was reset in connection to github.com:443

    git config --global --get http.proxy
    
    • 1

    参考:
    Getting Git to work with a proxy server - fails with “Request timed out”

    ! [remote rejected] main -> main (Internal Server Error)

     ! [remote rejected] main -> main (Internal Server Error)
    error: failed to push some refs to 'https://github.com/anthonyweidai/Advanced_SPL_Classification.git'
    
    • 1
    • 2

    解决方法:

    git config --bool core.bare true
    
    • 1

    参考:
    Git push error ‘[remote rejected] master -> master (branch is currently checked out)’

    fatal: this operation must be run in a work tree

    git config --unsetcore.bare
    
    • 1

    参考:
    [FIXED] fatal: this operation must be run in a work tree

    The term ‘conda’ is not recognized as the name of a cmdlet

    The term 'conda' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again
    
    • 1

    解决方法:
    Add

    S:\ProgramData\Anaconda3
    S:\ProgramData\Anaconda3\Scripts
    S:\ProgramData\Anaconda3\Library\bin
    
    • 1
    • 2
    • 3

    to environment.
    Or install anaconda with adding path environment option.
    Reboot computer.

    conda init powershell
    conda init cmd.exe
    
    • 1
    • 2

    Git upper case lower case

    git config --global core.ignorecase false
    
    • 1

    参考资料:
    How do you change the capitalization of filenames in Git?

    Others

    the system cannot find the path specified

    Click the file inside the zip, and then unzip inside files directly.

    ‘npm’ is not recognized as an internal or external command

    下载Nodejs,download Nodejs.

  • 相关阅读:
    企业为什么要做数字化转型,应该如何进行转型?
    网络安全学习:操作系统安装部署
    2024年宝鸡市国家级、省级、市级科技企业孵化器申报奖励补贴标准及申报条件
    FFmpeg5.1.3编译动态库踩坑之旅(基于Linux虚拟机)
    C/C++仓库管理系统
    【Spring】Spring的AspectJ的AOP
    树递归遍历和Mirrors遍历
    【C语言初阶】一、初识C语言
    【LSTM回归预测】基于matlab布谷鸟算法优化LSTM回归预测【含Matlab源码 2037期】
    react 高价组件HOC实现组件复用
  • 原文地址:https://blog.csdn.net/Davidietop/article/details/132689127