Skip to content

Ananas1Anass/Cellular_counting

Repository files navigation

Goal

In this repository, we implement a fully convolutional regression networks (FCRNs) approach for regression of a density map in order to get density map of cell pictures for biomedical goals.

Generation of Database

Generating squares randomly positionned in a 100x100 image. First step is to randomly position the squares, then get the coordinates of the center of squares, and apply Gaussian filter over them for ground truth. Example from dataset :

Light         Dark

Network description

Light

Test on example :

Light         Dark

Light         Dark

Requirements :

git clone GIT_repo
pip install -r requirements.txt

Training/Validation

SquareDataset

The SquareDataset is a custom dataset class designed for use with PyTorch. It extends the VisionDataset class and is specifically tailored for tasks involving paired image data, such as image-to-image translation.

Class Overview

Constructor Parameters

  • root (str): The root directory of the dataset, containing 'input' and 'ground' subdirectories for input and ground truth images respectively.

  • transform (Optional[Callable]): A function/transform to apply to input and ground truth images.

  • target_transform (Optional[Callable]): A function/transform to apply to target images.

  • transforms (Optional[Callable]): A function/transform to apply to both input and target images.

Methods

  • __getitem__(index: int) -> Tuple[Any, Any]: Retrieves an item at a given index, returning a tuple with the input and ground truth images.

  • __len__() -> int: Returns the total number of items in the dataset.

Architecture

The dataset class leverages the PyTorch library, utilizing the PIL (Pillow) for image handling and torchvision.transforms for image transformations. It efficiently organizes and loads paired images from specified directories, making them easily accessible for training machine learning models.

Example Usage

from square_dataset import SquareDataset
from torchvision import transforms

# Define transformations
transform = transforms.Compose([
    transforms.Resize((256, 256)),
    transforms.ToTensor()
])

# Initialize the dataset with transformations
dataset = SquareDataset(root='path_to_dataset_root', transform=transform)

# Access the first item
input_image, ground_truth_image = dataset[0]

🔗 Links

Authors

  author    = {BOUKHEMS Anass and
               Taha Mohammed Elqandili},
  title     = {Cellular counting using convolutional network},
  year      = {2021},
  emails    =  {[email protected],
              [email protected] }

About

Counting number of cell in a picture of cells

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages