Skip to content

bioinfokushwaha/ASTPredict

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Colony Detection (ASTPredict)

This repository contains the setup and inference scripts for the Colony Detection. It uses a trained model to detect colonies in images, generating visual annotations and statistical metadata.

Project Structure

  • setup.sh: Bash script to install all required dependencies.
  • inference.py: Main Python script to run model predictions.
  • best.pt: The trained YOLOv8 model weights (must be present in the root directory).
  • test_images/: Default directory for placing input images.
  • Results/: Output directory (auto-generated) where annotated images and prediction JSONs are saved.

1. Environment Setup

Before running the inference script, you need to install the required Python packages (ultralytics for YOLO, and opencv-python).

Open your terminal, navigate to this directory, and run the setup script:

# Make the script executable (macOS/Linux)
chmod +x setup.sh

# Run the setup script
./setup.sh

2. Running Inference

The inference.py script allows you to process either a full directory of images or a single image. It will output annotated images with bounding boxes and a predictions.json file containing all the statistical data (bounding box coordinates, confidence scores, etc.).

Basic Usage (Batch Processing)(Use python3)

If you want to run the inference on sample images in ./test_images directory, simply run:

python3 inference.py

Custom Input Directory

To run batch inference on a specific folder of images:

python3 inference.py -i /path/to/your/custom_directory/

Single Image Processing

To run inference on just one specific image:

python3 inference.py -i /path/to/image.jpg

Adjusting Confidence Threshold

By default, the script only considers detections with a confidence score of 0.25 or higher. You can adjust this using the -c or --conf flag. For example, to require a 50% confidence:

python3 inference.py -i /path/to/image.jpg -c 0.5

3. Viewing Results

After inference is complete, check the ./Results folder.

  • Results/images/: Contains copies of your images drawn with bounding boxes and confidence scores.
  • Results/predictions/predictions.json: Contains detailed JSON output of every detection (class, confidence, and normalized/pixel bounding box coordinates).

4. Class - Species Table

Class Bacteria Species
class0 Actinobacillus equuli
class1 Actinobacillus pleuropneumoniae
class2 Aeromonas hydrophila
class3 Bacillus cereus
class4 Bibersteinia trehalosi
class5 Bordetella bronchiseptica
class6 Brucella ovis
class7 Clostridium perfringens
class8 Corynebacterium pseudotuberculosis
class9 Erysipelothrix rhusiopathiae
class10 Escherichia coli
class11 Glaesserella parasuis
class12 Klebsiella pneumoniae
class13 Listeria monocytogenes
class14 Paenibacillus larvae
class15 Pasteurella multocida
class16 Proteus mirabilis
class17 Pseudomonas aeruginosa
class18 Rhodococcus equi
class19 Salmonella enterica
class20 Staphylococcus aureus
class21 Staphylococcus hyicus
class22 Streptococcus agalactiae
class23 Trueperella pyogenes

About

Bacterial Species Identification, Quantification and Antibiotic Susceptibility Prediction

Resources

Stars

1 star

Watchers

1 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors