Skip to content

Add Pneumothorax dataset - #93

Merged
gdefe merged 2 commits into
pyc-team:devfrom
achaudhary2304:feat/pneumothorax-dataset
Oct 28, 2026
Merged

gdefe merged 2 commits into
pyc-team:devfrom
achaudhary2304:feat/pneumothorax-dataset

Conversation

@achaudhary2304

Copy link
Copy Markdown

Add the Pneumothorax dataset, patient-grouped datamodule, and a CLIP concept-generation example.

Tested on the ~12k labeled Stage 2 images and ran the relevant PyC tests.

Comment thread examples/data/07_pneumothorax.py Outdated
# ------------------
CONCEPTS = [
"a chest x-ray with a visible pleural line",
"a chest x-ray with absent peripheral lung markings",

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we might want to avoid using "absent" in CLIP prompts as it tends to avoid it and invert the labels. Could you have posive sentences only?

@achaudhary2304 achaudhary2304 Oct 28, 2026 •

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay,I have removed the "absent" sentences



def _patient_grouped_split(patient_ids, val_size, test_size, seed):
"""Assign whole patients to one split, preventing patient leakage."""

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My understanding is that, in SIIM-ACR, PatientID is an anonymized ID unique to each image (12,047 IDs for 12,047 images). So the patient-grouped split is effectively per image and can't prevent patient leakage. Would this then be equivalent to a random split?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes ,I missed it and you are correct ,it is equivalent to the random split,I have updated the description and also have removed the custom function and it now uses the RandomSplitter itself

class PneumothoraxDataModule(ConceptDataModule):
"""DataModule for SIIM-ACR Pneumothorax chest radiographs.

The competition test images have no labels, so SIIM-ACR does not provide

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My understanding is that the competition test images do have labels: stage_2_train.csv labels the stage-1 test images, and 1,372 of the 12,047 images in this dataset come from dicom-images-test right?

do we need rephrasing this ?

an official labeled train/validation/test split. The default split groups
all images from a DICOM ``PatientID`` into the same partition. If a source
file omits that field, the dataset falls back to grouping that image by its
own ID. In that case, patient separation cannot be guaranteed.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If indeed on SIIM the IDs are per image, then patient separation is never guaranteed and this sentence "In that case" might need rewording.

@gdefe

gdefe commented Oct 27, 2026

Copy link
Copy Markdown
Collaborator

shall we also need to add "kagglehub" and "pydicom" under the "data" optional dependencies in pyproject.toml? These seem to be necessary to download the dataset.

@codecov

codecov Bot commented Oct 27, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

…on more accurate ,also added the imports in the file
@achaudhary2304

Copy link
Copy Markdown
Author

@gdefe I have also added the kagglehub and the pydicom as optional dependencies in the pyproject file in the latest commit.

@gdefe
gdefe merged commit c4bfcb9 into pyc-team:dev Oct 28, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants