Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Single predictions list index out of range in foundation.py #521

Open
@NZ369

Description

@NZ369

After loading a model when conduction single predictions, there is a list index out of range issue. The issue is located in foundation.py file, specifically line 120 (else [self.items[i_] for i_ in i]) which assumes batch input.

Input code:
! [ -e /content ] && pip install -Uqq fastbook
import fastbook
fastbook.setup_book()
from fastai.vision.all import *

learn = load_learner('export.pkl')

learn.predict(img)

Error output:

IndexError Traceback (most recent call last)
in
----> 1 learn.predict(img)

20 frames
/usr/local/lib/python3.9/dist-packages/fastcore/foundation.py in (.0)
118 return (self.items.iloc[list(i)] if hasattr(self.items,'iloc')
119 else self.items.array()[(i,)] if hasattr(self.items,'array')
--> 120 else [self.items[i_] for i_ in i])
121
122 defsetitem(self, idx, o):

IndexError: list index out of range

Capture

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp