Skip to main content

A simple template for creating GUI PyTorch medical image segmentation applications

Project description

Speedy GUI

Speedy GUI is a Python package that provides a quick template graphical user interface (GUI) for running inference on image segmentation datasets. It allows you to select a folder containing images, run a pre-trained PyTorch model, and save the predicted masks to a specified directory.

https://github.com/justincharney/speedygui/assets/56408885/6a6435fe-3073-4618-a31a-3188ea58eb25

Installation

You can install the package from PyPI using pip:

pip install speedygui

Usage

To use the Predictor GUI, you need to provide the following components:

  • A PyTorch model for prediction
  • A dataset creator function to make a PyTorch Dataset
  • Dataloader keyword arguments
  • A save predictions function to store the outputs
  • An optional output transformation function

Here's a basic example of how to create and run the Predictor GUI application:

from speedygui import Predictor
import torch

# Define your dataset creator function
def dataset_creator(folder_path):
    # ...

# Load your model
model = torch.hub.load('your/model/path', 'model_name')

# Define dataloader keyword arguments
dataloader_kwargs = {
    'batch_size': 1,
    'shuffle': False,
    'num_workers': 0,
}

# Define a save predictions function
def save_predictions_fn(folder_path, predictions, dataset):
    # ...

# Define an optional output transform function
def output_transform(outputs):
    # ...

# Create the Predictor instance
predictor = Predictor(model, dataset_creator, dataloader_kwargs, save_predictions_fn=save_predictions_fn, output_transform=output_transform)

# Create and run the GUI application
app = predictor.create_app('Predictor App', 'org.example.predictor')
app.main_loop() 

Running the Examples

To run the examples, you need to install the example dependencies separately:

  1. Install the speedygui package:
    pip install speedygui
  2. Navigate to the examples directory:
    cd /path/to/speedygui_project/examples
  3. Install the example dependencies:
    pip install -r requirements.txt

You can also use briefcase to create and distribute the app (brain_segmentation). This is based on using windows:

  1. Install the briefcase package:
    pip install briefcase
  2. Make any adjustments to the /pyproject.toml file or leave as defaults
  3. Test the application by running:
    briefcase dev
  4. Create your application by running:
    briefcase create
  5. Build your application by running:
    briefcase build
  6. Run your application with:
    briefcase run
  7. Package your app by running:
    briefcase package
    This will create a msi file in the dist folder

Contributing

Contributions are welcome! Please open an issue or submit a pull request.

License

This project is licensed under the MIT License.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

speedygui-0.1.3.tar.gz (7.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

speedygui-0.1.3-py3-none-any.whl (6.8 kB view details)

Uploaded Python 3

File details

Details for the file speedygui-0.1.3.tar.gz.

File metadata

  • Download URL: speedygui-0.1.3.tar.gz
  • Upload date:
  • Size: 7.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.9.6

File hashes

Hashes for speedygui-0.1.3.tar.gz
Algorithm Hash digest
SHA256 0a206de931fd5f96d54c508b5eb465b911f88c2a0cf0b204fb9c2b0e25a7be9a
MD5 3e6809908f4a3c2cfbfbc729f18f1e32
BLAKE2b-256 01e68864e1831f4bdbe1944036340be461f6bd64a18ad01a0c3f115d9d28ccdb

See more details on using hashes here.

File details

Details for the file speedygui-0.1.3-py3-none-any.whl.

File metadata

  • Download URL: speedygui-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 6.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.9.6

File hashes

Hashes for speedygui-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 34861a51170321d5a19d9009fb684aac487989556e85e4a64a5794bc21d68082
MD5 7d12fc0c1311f9905b50691c836c71c6
BLAKE2b-256 de591c64da7fad9d672fa3559ea3decbdaea3c975df9fddc85f8925b38ea3ebf

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page