Giter Site home page Giter Site logo

Comments (4)

kjgeras avatar kjgeras commented on June 7, 2024 1

It shouldn't matter which format you use as long as you correctly replace the part of the code which is loading the images. We chose that format simply because it was the fastest to load when we tested it on our cluster.

from breast_cancer_classifier.

zphang avatar zphang commented on June 7, 2024

Hi @aisosalo, I'm not 100% sure I understand your issue. The purpose of use-hdf5 is to read inputs that are in hdf5 format. We have not currently provided any hdf5 format sample inputs with the repository. It sounds like the functionality you're looking for is writing hdf5 formats instead? Let me know if I'm mischaracterizing your issue.

from breast_cancer_classifier.

aisosalo avatar aisosalo commented on June 7, 2024

Thank you for your answer, it resolved my issue. I clearly misunderstood the purpose of the use-hdf5 parameter.

My purpose was to make a script to ease monitoring the heatmap generation using PyCharm:

"""
Method adapted from breast_cancer_classifier function `run_producer` by
Nan Wu, Jason Phang, Jungkyu Park, Yiqiu Shen, Zhe Huang, Masha Zorin,
Stanisław Jastrzębski, Thibault Févry, Joe Katsnelson, Eric Kim, Stacey Wolfson, Ujas Parikh,
Sushma Gaddam, Leng Leng Young Lin, Kara Ho, Joshua D. Weinstein, Beatriu Reig, Yiming Gao,
Hildegard Toth, Kristine Pysarenko, Alana Lewin, Jiyon Lee, Krystal Airola, Eralda Mema,
Stephanie Chung, Esther Hwang, Naziya Samreen, S. Gene Kim, Laura Heacock, Linda Moy,
Kyunghyun Cho, and Krzysztof J. Geras , which is licensed under a GNU Affero General Public License v3.0.
See: https://github.com/nyukat/breast_cancer_classifier/blob/master/LICENSE
"""

import sys
import os
import random

import argparse

from src.heatmaps.run_producer import produce_heatmaps
from src.heatmaps.run_producer import load_model

print(sys.version, sys.platform, sys.executable)


if __name__ == "__main__":
    parser = argparse.ArgumentParser(description='Generate heatmaps')
    parser.add_argument('--exam-list-path', default='sample_output/exam_list.pkl')
    parser.add_argument('--image-path', default='sample_output/cropped_images')
    parser.add_argument('--output-heatmap-path', default='sample_output/heatmaps')
    parser.add_argument('--model-path', default='models/sample_patch_model.p')
    parser.add_argument('--batch-size', default=100, type=int)
    parser.add_argument('--use-hdf5', choices=[False, True], default=False)
    parser.add_argument('--device-type', choices=['gpu', 'cpu'], default='gpu')
    parser.add_argument('--gpu-number', type=int, default=0)
    parser.add_argument('--seed', default=0, type=int)
    args = parser.parse_args()

    # Set the seed
    random.seed(args.seed)

    params = dict(
        device_type=args.device_type,
        gpu_number=args.gpu_number,
        patch_size=256,
        stride_fixed=70,
        more_patches=5,
        minibatch_size=args.batch_size,
        seed=args.seed,
        initial_parameters=args.model_path,
        input_channels=3,
        number_of_classes=4,
        data_file=args.exam_list_path,
        original_image_path=args.image_path,
        save_heatmap_path=[os.path.join(args.output_heatmap_path, 'heatmap_malignant'),
                           os.path.join(args.output_heatmap_path, 'heatmap_benign')],
        heatmap_type=[0, 1],
        use_hdf5=args.use_hdf5  # when using hdf5 format sample inputs
    )

    # Get model
    model, device = load_model(params)

    # Generate heatmaps in the chosen format
    produce_heatmaps(model, device, params)

from breast_cancer_classifier.

aisosalo avatar aisosalo commented on June 7, 2024

What might be the possible benefits of using hdf5 format mammogram images as an input to the network? Is it something to consider when fine-tuning the pre-trained models for a different dataset?

from breast_cancer_classifier.

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.