Giter VIP home page Giter VIP logo

Comments (6)

ieee8023 avatar ieee8023 commented on September 17, 2024 1

I just tried with two random images from MIMIC and the outputs change with scripts/process_image.py:

$ python3 process_image.py mimic/s50752076/90c22043-e189c0ff-6fb7432e-fe2dbddd-6e254412.jpg 
{'preds': {'Atelectasis': 0.8238672,
           'Cardiomegaly': 0.7937068,
           'Consolidation': 0.6639328,
           'Edema': 0.64718884,
           'Effusion': 0.8994624,
           'Emphysema': 0.34765577,
           'Enlarged Cardiomediastinum': 0.6454991,
           'Fibrosis': 0.3462754,
           'Fracture': 0.54863507,
           'Hernia': 0.10696117,
           'Infiltration': 0.60848004,
           'Lung Lesion': 0.5194453,
           'Lung Opacity': 0.7979231,
           'Mass': 0.51675844,
           'Nodule': 0.43947062,
           'Pleural_Thickening': 0.39090982,
           'Pneumonia': 0.5910077,
           'Pneumothorax': 0.52356243}}
BFLY-C02G10AMML7H-MBP:scripts ieee8023$ python3 process_image.py mimic/s50752076/a5b86009-73d89547-016407ee-f7d9a239-9bbc4465.jpg 
{'preds': {'Atelectasis': 0.78038526,
           'Cardiomegaly': 0.72883594,
           'Consolidation': 0.67473954,
           'Edema': 0.64642406,
           'Effusion': 0.82089716,
           'Emphysema': 0.51148427,
           'Enlarged Cardiomediastinum': 0.61464787,
           'Fibrosis': 0.5282905,
           'Fracture': 0.55740416,
           'Hernia': 0.10064988,
           'Infiltration': 0.57235926,
           'Lung Lesion': 0.5776483,
           'Lung Opacity': 0.77271074,
           'Mass': 0.54339457,
           'Nodule': 0.51708037,
           'Pleural_Thickening': 0.52615666,
           'Pneumonia': 0.55208266,
           'Pneumothorax': 0.5493742}}

Potentially you are not scaling the images to between [-1024, 1024] ?

from torchxrayvision.

ieee8023 avatar ieee8023 commented on September 17, 2024 1

I think we should probably issue a warning if the input images are not scaled correctly (by ensuring there are values outside the range [-1,255]). I've mainly just been afraid of slowing down performance but I think we can only check on the first batch and it won't hurt performance for batch processing.

from torchxrayvision.

mohkoh19 avatar mohkoh19 commented on September 17, 2024 1

When I answered I just removed the [0, 1] scaling at the end of the pre-processing leading to [0, 255] scaling and could see differences in output already. I rescaled to [-1024, 1024] later using the xrv.datasets.normalize(img, 255) function and it works fine, thank you.

from torchxrayvision.

mohkoh19 avatar mohkoh19 commented on September 17, 2024

Thank you for your reply. I used the ToTensor() transform from torchvision, which scales between [0,1]. I changed the scaling to [0,255] and I can confirm your output. Should've read the paper...

from torchxrayvision.

ieee8023 avatar ieee8023 commented on September 17, 2024

I changed the scaling to [0,255]

@mohkoh19 do you mean to ran the code xrv.datasets.normalize(img, 255) ? The correct scaling range is [-1024, 1024]. The 255 in that function call indicates it will take an 8-bit image (with values 0-255) and scale it up.

from torchxrayvision.

ieee8023 avatar ieee8023 commented on September 17, 2024

The feature discussed is now released in https://github.com/mlmed/torchxrayvision/releases/tag/0.0.37 !

from torchxrayvision.

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.