Coder Social home page Coder Social logo

Flash fails to load image labels from CSV on Kaggle RANZCR CLiP - Catheter and Line Position Challenge about lightning-flash HOT 5 CLOSED

lightning-universe avatar lightning-universe commented on May 18, 2024
Flash fails to load image labels from CSV on Kaggle RANZCR CLiP - Catheter and Line Position Challenge

from lightning-flash.

Comments (5)

teddykoker avatar teddykoker commented on May 18, 2024 1

You need to use ImageClassificationData.from_filepaths(), and then supply the filenames and labels as lists. The image paths will need to be extracted from the csv, something like:

# load in csv
df = pd.read_csv("train.csv")

# extract ids
ids = list(df["StudyInstanceUID"])

# get filenames by appending .jpg to id
filenames = [f"{id}.jpg" for id in ids]

# from https://www.kaggle.com/heyytanay/torch-trainer-augmentations-nfnets
# get labels for each id
labels = [label = df[df['StudyInstanceUID'] == id].values.tolist()[0][1:-1] for id in ids] 


# hypothetically you could do this, if it wasn't multilabel, see note below
data = ImageClassificationData.from_filepaths(train_filepaths=filenames, train_labels=labels, ...)

NOTE: looking at the Kaggle competition this data appears to be multi-label, which the ImageClassificationData does not support (yet?)

from lightning-flash.

edenlightning avatar edenlightning commented on May 18, 2024

Looks like we need to update the docs on how to pass in train_labels (need to provide an array of labels, not a filepath)

from lightning-flash.

aribornstein avatar aribornstein commented on May 18, 2024

In the code it makes it seem as if you can pass a file. Will also claimed that he had this working is it possible something changed?

See line 304

https://github.com/PyTorchLightning/lightning-flash/blob/master/flash/vision/classification/data.py

from lightning-flash.

aribornstein avatar aribornstein commented on May 18, 2024

Yes that's something missing from the prediction interface a way to see the labels and a way to get the prediction class distribution. @williamFalcon

from lightning-flash.

williamFalcon avatar williamFalcon commented on May 18, 2024

https://github.com/PyTorchLightning/lightning-flash/blob/master/flash/data/data_utils.py#L6

from lightning-flash.

Related Issues (20)

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.