Skip to main content

Deep Learning Based FTIR Polymer Classification

Project description

FTIRNet

FTIRNet is a deep learning-powered Python package for polymer identification from FTIR (Fourier Transform Infrared Spectroscopy) spectra.

Using a 1D Convolutional Neural Network (CNN), FTIRNet can classify FTIR spectra into common polymer categories with a simple Python API or command-line interface.

Features

  • Deep Learning-based FTIR classification
  • Simple Python API
  • Command Line Interface (CLI)
  • Supports multiple trained models
  • Returns prediction confidence scores
  • Returns probabilities for all supported polymer classes
  • Lightweight package with bundled pretrained weights

Supported Polymer Classes

  • HDPE (High-Density Polyethylene)
  • LDPE (Low-Density Polyethylene)
  • PET (Polyethylene Terephthalate)
  • PP (Polypropylene)
  • PS (Polystyrene)
  • PVC (Polyvinyl Chloride)

Installation

pip install ftirnet

Input Format

FTIRNet expects a processed FTIR CSV file where:

  • Each row represents a spectrum

  • Feature columns contain absorbance/transmittance values

  • Optional columns:

    • Sample_ID
    • Polymer

Example:

Sample_ID,Polymer,f_600,f_602,f_604,f_606,...
HDPE004,HDPE,95.74,95.69,95.75,95.89,...

For inference, the Polymer column is optional and will be ignored if present.


Python API

Basic Prediction

import ftir

result = ftir.predict(
    "sample.csv"
)

print(result.prediction)
print(result.confidence)

Using a Specific Model

import ftir

result = ftir.predict(
    "sample.csv",
    model="pretrained"
)
import ftir

result = ftir.predict(
    "sample.csv",
    model="base"
)

Prediction Result Object

The predict() function returns an FTIRResult object.

Prediction

print(result.prediction)

Example:

HDPE

Confidence Score

print(result.confidence)

Example:

93.95

Sample ID

print(result.sample_id)

Example:

HDPE004

Class Probabilities

print(result.probabilities)

Example:

{
    "HDPE": 93.95,
    "LDPE": 2.67,
    "PET": 0.99,
    "PP": 0.55,
    "PS": 1.28,
    "PVC": 0.56
}

Access Individual Class Probabilities

print(result.probabilities["HDPE"])

Command Line Interface

Default Prediction

ftir sample.csv

Use Pretrained Model

ftir sample.csv --model pretrained

Use Base Model

ftir sample.csv --model base

Help

ftir --help

Available Models

Model Description
pretrained Transfer learning based model with higher accuracy
base Base CNN model trained from scratch

Example Output

Sample ID : HDPE004
Prediction: HDPE
Confidence: 93.95%

Probabilities:

HDPE      : 93.95%
LDPE      : 2.67%
PET       : 0.99%
PP        : 0.55%
PS        : 1.28%
PVC       : 0.56%

Requirements

  • Python 3.11+
  • PyTorch
  • NumPy
  • Pandas
  • Scikit-learn
  • Joblib

Citation

If you use FTIRNet in academic research, please cite the associated project or publication when available.


License

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

ftirnet-0.1.2.tar.gz (12.8 MB view details)

Uploaded Source

Built Distribution

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

ftirnet-0.1.2-py3-none-any.whl (12.8 MB view details)

Uploaded Python 3

File details

Details for the file ftirnet-0.1.2.tar.gz.

File metadata

  • Download URL: ftirnet-0.1.2.tar.gz
  • Upload date:
  • Size: 12.8 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.8

File hashes

Hashes for ftirnet-0.1.2.tar.gz
Algorithm Hash digest
SHA256 705ce4ce75180c63ba2a792f3895e44a7c97ab2c243154edf1fa8b5677c18031
MD5 07dc46e501d3a1dcf3a24a92ff558d1b
BLAKE2b-256 182c8eb6918441b94b3c1079c5a6a3176485261c7ad35a56ec300efb36770ddc

See more details on using hashes here.

File details

Details for the file ftirnet-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: ftirnet-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 12.8 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.8

File hashes

Hashes for ftirnet-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 931d84712986de1482e2d5e1427e3f8f249d625e19b876e299b4f59592577e88
MD5 a2959ebbf6af2b3240864b9c26316a11
BLAKE2b-256 eb393472e77216b6ba447fcb0cc2544d045769242b9817a02736e2ccbbd3d7c8

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