Skip to content

Commit

Permalink
Reset index to avoid indexing error
Browse files Browse the repository at this point in the history
  • Loading branch information
fcogidi committed Oct 24, 2024
1 parent 83cf1e8 commit a247b4e
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions projects/med_benchmarking/datasets/pad_ufes_20.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,14 @@

import pandas as pd
import torch
from omegaconf import MISSING
from PIL import Image
from torch.utils.data import Dataset
from torchvision.transforms import CenterCrop, Compose, Resize, ToTensor

from mmlearn.conf import external_store
from mmlearn.constants import EXAMPLE_INDEX_KEY
from mmlearn.datasets.core import Modalities
from mmlearn.datasets.core.example import Example
from omegaconf import MISSING
from PIL import Image
from torch.utils.data import Dataset
from torchvision.transforms import CenterCrop, Compose, Resize, ToTensor


@external_store(group="datasets", root_dir=os.getenv("PADUFES_ROOT_DIR", MISSING))
Expand Down Expand Up @@ -69,7 +68,9 @@ def _load_and_process_metadata(self) -> pd.DataFrame:
df["path"] = df["img_id"].apply(
lambda imgid: os.path.join(self.root_dir, "Dataset", imgid)
)
df.drop(columns=["img_id", "diagnostic"], inplace=True)
df.drop(columns=["img_id", "diagnostic"], inplace=True).reset_index(
drop=True, inplace=True
)

# Split into train and test
dataset = {}
Expand Down

0 comments on commit a247b4e

Please sign in to comment.