在Colab上使用image_tabular(pythongithub包)

2024-10-04 07:37:57 发布

您现在位置:Python中文网/ 问答频道 /正文

我正在通过GoogleColab使用Python,我想使用github包image\u tabular,以便在CNN图像分类器中包含表格数据信息

https://github.com/naity/image_tabular

但我无法正确地将包从github导入colab,并使用其功能性

# clone package repository
!git clone https://github.com/naity/image_tabular.git

# navigate to atalaia directory
%cd image_tabular

!pip install --upgrade --force-reinstall image_tabular

from image_tabular.core import *
   # NameError: name 'Tuple' is not defined

我不知道如何解释这个错误,有人有什么建议/意见吗?是否有可能github包没有正确导入

tab_data = (TabularList.from_df(tab_df, path = data_path, cat_names = cat_names, procs = procs).label_from_df(cols = ycol))
╭───────────────────── Traceback (most recent call last) ──────────────────────╮
│ /usr/local/lib/python3.7/dist-packages/IPython/core/interactiveshell.py:2882 │
│ in run_code                                                                  │
│                                                                              │
│   2879 │   │   │   try:                                                      │
│   2880 │   │   │   │   self.hooks.pre_run_code_hook()                        │
│   2881 │   │   │   │   #rprint('Running code', repr(code_obj)) # dbg         │
│ ❱ 2882 │   │   │   │   exec(code_obj, self.user_global_ns, self.user_ns)     │
│   2883 │   │   │   finally:                                                  │
│   2884 │   │   │   │   # Reset our crash handler in place                    │
│   2885 │   │   │   │   sys.excepthook = old_excepthook                       │
│ <ipython-input-88-9b2e6c7077ac>:1 in <module>                                │
╰──────────────────────────────────────────────────────────────────────────────╯

   # NameError: name 'TabularList' is not defined

多谢各位


Tags: infromhttpscoreimagegitselfgithub