Giter VIP home page Giter VIP logo

Comments (4)

duducheng avatar duducheng commented on July 26, 2024

I prefer to inherit your targeted Python class and override the __init__ method.

from medmnist.

en-ashay avatar en-ashay commented on July 26, 2024
data_flag = 'chestmnist'
download = True
classes=2
NUM_EPOCHS = 3
BATCH_SIZE = 128
lr = 0.001

info = INFO[data_flag]
task = info['task']
n_channels = info['n_channels']
n_classes = len(info['label'])

DataClass = getattr(medmnist, info['python_class'])
# preprocessing
data_transform = transforms.Compose([
    transforms.ToTensor(),
    transforms.Normalize(mean=[.5], std=[.5])
])

# load the data
train_dataset = DataClass(split='train', transform=data_transform, download=download,)
test_dataset = DataClass(split='test', transform=data_transform, download=download)

pil_dataset = DataClass(split='train', download=download)

# encapsulate data into dataloader form
train_loader = data.DataLoader(dataset=train_dataset, batch_size=BATCH_SIZE, shuffle=True)
train_loader_at_eval = data.DataLoader(dataset=train_dataset, batch_size=2*BATCH_SIZE, shuffle=False)
test_loader = data.DataLoader(dataset=test_dataset, batch_size=2*BATCH_SIZE, shuffle=False)

Here are you talking about below "DataClass"

DataClass = getattr(medmnist, info['python_class'])

from medmnist.

duducheng avatar duducheng commented on July 26, 2024

Indeed

from medmnist.

en-ashay avatar en-ashay commented on July 26, 2024
import numpy as np

# Load the .npz file
data = np.load('chestmnist.npz')

# Get the names of the arrays in the file
array_names = data.files

# Create an empty dictionary to store the arrays
arrays_dict = {}

# Iterate over the array names and store the arrays in the dictionary
for name in array_names:
    arrays_dict[name] = data[name]

['train_images', 'val_images', 'test_images', 'train_labels', 'val_labels', 'test_labels']

here the order of image values and labels are in same order of index?

Could I pick some train lables and get the train_images with same index would it match?

from medmnist.

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.