GithubHelp home page GithubHelp logo

l3ickey / mprg-spring-seminar-competition-2021 Goto Github PK

View Code? Open in Web Editor NEW
0.0 0.0 0.0 124 KB

https://www.kaggle.com/c/mprg-spring-seminar-competition-2021/data

Python 99.70% Dockerfile 0.07% Shell 0.23%

mprg-spring-seminar-competition-2021's People

Contributors

l3ickey avatar

Watchers

 avatar  avatar

mprg-spring-seminar-competition-2021's Issues

predict.py で batch_size がテストデータ数で割り切れないとエラーになる

# 評価
print("評価を始めるっぴ!")
class_correct = list(0. for i in range(len(classes)))
class_total = list(0. for i in range(len(classes)))
with torch.no_grad():
    for data in testloader:
        images, labels = data[0].to(device), data[1].to(device)
        outputs = net(images)
        _, predicted = torch.max(outputs, 1)
        c = (predicted == labels).squeeze()

        for i in range(args.batch_size):
            label = labels[i]
            class_correct[label] += c[i].item()
            class_total[label] += 1

下から4行目の for i in range(args.batch_size) でバッチサイズ分ループを回しているが,テストデータの一番最後で batch_size で割り切れなかった端数のテストデータを扱う際も下から3行目の label = labels[i] でバッチサイズ分アクセスしようとするためエラーが発生する.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.