PyTorch solution to find 19 cephalometric landmarks from a lateral cephalogram from CLI.
Model provided to predict landmarks is trained from the source code and datasets from Cephalometric Landmark Detection by Attentive Feature Pyramid Fusion and Regression-Voting. Repo here.
pip install git+https://github.com/zhangted/py-ceph
from pyceph.pyceph import predict
results = predict(image_src='tests/test-images/001.jpg', device='cpu')
for res in results: print(res)
"""
{'Sella': (274, 369), 'Nasion': (472, 358), 'Orbitale': (429, 447), 'Porion': (204, 424), 'Subspinale': (468, 542), 'Supramentale': (446, 669), 'Pogonion': (440, 716), 'Menton': (418, 740), 'Gnathion': (433, 732), 'Gonion': (237, 635), 'Incision Inferius': (470, 609), 'Incision Superius': (476, 612), 'Upper Lip': (521, 585), 'Lower Lip': (503, 654), 'Subnasale': (507, 542), 'Soft Tissue Pogonion': (485, 727), 'Posterior Nasal Spine': (319, 511), 'Anterior Nasal Spine': (474, 518), 'Articulare': (223, 473)}
"""
results = predict(image_folder='tests/test-images', device=0)
py-ceph --image_src "image path string"
Output
- image with landmarks shown in pyplot viewer
- labeled landmarks displayed in console
py-ceph --image_folder "image folder path string"
Output
- create
predicted_images
folder in provided directory- image overlayed with predicted landmarks
- csv with the coordinates for each labeled landmark
In the app directory, run
pytest
Non-CLI usage- PyPi package
- Python 3.10+
- pyyaml
- pytest
- torch
- numpy
- torch
- matplotlib
- scikit-image