【问题标题】:Custom module not found error on google colab在 google colab 上找不到自定义模块错误
【发布时间】:2023-02-22 01:41:52
【问题描述】:

我正在尝试在 google colab 中运行 pytorch 代码。 github存储库是:

GitHub - BrightXiaoHan/FaceDetector: A re-implementation of mtcnn. Joint training, tutorial and deployment together.

google colab notebook 中有一个自定义模块。为了构建我运行的模块python setup.py build_ext --inplace

我的文件夹结构:

ls /content/drive/MyDrive/FaceDetector

doc  mtcnn  output  README.md  scripts  setup.py  tests  tutorial

我还在系统路径中添加了

import sys
sys.path.append('/content/drive/MyDrive/FaceDetector')

所以当我尝试导入它时

import mtcnn

我收到一个错误:

ModuleNotFoundError                       
Traceback (most recent call last)

[<ipython-input-61-eb80d650f81e>](https://localhost:8080/#) in <module>
----> 1 import mtcnn

---

2 frames

---

[/content/drive/MyDrive/FaceDetector/mtcnn/deploy/detect.py](https://localhost:8080/#) in <module>
      4 import time
      5 ----> 6 import mtcnn.utils.functional as func
      7       8 def _no_grad(func):

ModuleNotFoundError: No module named 'mtcnn.utils.functional'

Google Colab 笔记本链接: https://colab.research.google.com/drive/1KQRF-HmZA7EU13acnwIX0dFayRMIuQ-B?usp=sharing

【问题讨论】:

    标签: python pytorch google-colaboratory


    【解决方案1】:

    使用!pip install...

    !pip install mtcnn
    import mtcnn
    

    【讨论】:

    • 我想使用 repo 作者提供的自定义模块。
    猜你喜欢
    • 1970-01-01
    • 2019-08-07
    • 2023-04-06
    • 2019-03-14
    • 2013-01-17
    • 1970-01-01
    • 1970-01-01
    • 2012-07-27
    • 2020-07-07
    相关资源
    最近更新 更多