โ—† UTY Yogyakarta ยท Informatics ยท 2023 ยท Final Project

AUTO
CAT FEEDER

Automatic feeding system based on cat face recognition using P-HOG feature extraction and K-Nearest Neighbor classification โ€” personalizing diet for each cat by age and nutritional needs.

ICP 2023 ยท PUBLISHED Computer Vision P-HOG ยท KNN IoT ยท Feeding Automation Python ยท OpenCV UTY Informatics
โ† ALL PROJECTS IndoLLNet โ–ถ
7
Cat Classes
86
Training Images
0%
Accuracy (K=1)
K=1
Best K Value
marchel@sys:~$ cat ./abstract.md
ABSTRACT.MD

The 2021 Javanese Script Congress wasn't the only problem Marchel was solving. At home, 7 cats of different ages needed different food portions โ€” but manual feeding was inconsistent.

This project builds an automatic cat feeder that identifies each cat by face using Pyramid HOG (P-HOG) feature extraction and classifies them with K-Nearest Neighbor (KNN), then dispenses the correct portion based on each cat's age-specific dietary requirements.

Dataset of 86 images across 7 cats โ€” photographed by Marchel himself using iPad 9th Generation (12MP, 3264ร—2448px).

PROJECT.JSON
PROJECT:Auto Cat Feeder
INSTITUTION:University of Technology Yogyakarta
LECTURER:Dr. Enny Itje Sela, S.Kom.M.Sc.
STUDENT ID:5200411552
YEAR:2023
ALGORITHM:P-HOG + K-NN
BEST K:K = 1 (95% accuracy)
DATASET:86 images ยท 7 classes
CAMERA:iPad 9th Gen ยท 31mm f/2.4 ยท 12MP
SCALES:4 pyramid levels (P-HOG)
DISTANCE:Euclidean Distance (KNN)
marchel@sys:~$ ls ./features/ --verbose
โ—ˆ
P-HOG Recognition
Pyramid Histogram of Oriented Gradients captures facial features at multiple scales (4 levels), making it robust to distance and angle variations in cat faces.
โŠž
Age-Based Portioning
Each cat is identified individually. The system then cross-references their age profile to dispense the correct nutritional portion โ€” no more manual guessing.
โ—Ž
K-NN Classification
K-Nearest Neighbor with Euclidean Distance tested across K = 1, 3, 5, 7, 9 and even/odd values. K=1 achieved the highest accuracy of 95% on test images.
marchel@sys:~$ cat ./methodology/pipeline.json
SYSTEM PIPELINE
๐Ÿ“ทIMAGE
CAPTURE
โ–ถ
โ—ฑIMAGE
PREPROCESSING
โ–ถ
โ–ฆP-HOG
EXTRACTION
โ–ถ
โŠžFEATURE
VECTOR
โ–ถ
โ—ˆKNN
CLASSIFY
โ–ถ
๐ŸฑCAT
IDENTITY
โ–ถ
๐ŸฝDISPENSE
PORTION
marchel@sys:~$ open ./architecture/phog_diagram.png
P-HOG ARCHITECTURE DIAGRAM
P-HOG Architecture Diagram
HOW P-HOG WORKS

Standard HOG computes gradient magnitudes and orientations in a 3ร—3 pixel block. P-HOG extends this by building a pyramid of scales โ€” the same face is analyzed at 4 different resolutions.

โ—† Gradient: Gx = I(r,c+1) โˆ’ I(r,cโˆ’1)
โ—† Magnitude: โˆš(Gxยฒ + Gyยฒ)
โ—† Orientation: |tanโปยน(Gy/Gx)|
โ—† Bins normalized across 36 orientations
โ—† 4 pyramid levels = richer spatial context
โ—† KNN distance via Euclidean metric
P-HOG PYRAMID VISUALIZATION
P-HOG pyramid visualization with cat
marchel@sys:~$ python eval.py --model phog_knn --report
KNN ACCURACY BY K VALUE
K ValueTypeAccuracyBar
K = 1Odd95%
K = 2Even80%
K = 3Odd85%
K = 4Even75%
K = 5Odd85%
K = 7Odd80%
K = 9Odd80%
โ—† Odd K values consistently outperform even K. K=1 achieves peak accuracy of 95%.
DATASET STATS
7
Cat Classes
86
Total Images
12MP
Camera Res
4
HOG Scales
36
Orientation Bins
3ร—3
Block Size
โ—† Classes: Alice, Eli, Laravel, Orbit, Python, Ruby, Theano
โ—† Images shot by Marchel using iPad 9th Generation
โ—† Multiple angles per cat for robustness
โ—† HEIC converted to JPG for processing
marchel@sys:~$ ls ./dataset/cats/ --portraits --classified
Alice โ€” dataset sample
Alice
CLASS_ALICE ยท 15 months
The eldest. Pure white with heterochromia.
Ruby โ€” dataset sample
Ruby
CLASS_RUBY ยท 13 months
Named after the programming language.
Eli โ€” dataset sample
Eli
CLASS_ELI ยท 5.5 months
Bright amber eyes, youngest of the litter.
Laravel โ€” dataset sample
Laravel
CLASS_LARAVEL ยท 5.5 months
Orange tabby, fearless and playful.
Python โ€” dataset sample
Python
CLASS_PYTHON ยท 5.5 months
Named after the language. Gentle cream coat.
Orbit โ€” dataset sample
Orbit
CLASS_ORBIT ยท 5.5 months
Dilute tortie with striking green eyes.
Theano โ€” dataset sample
Theano
CLASS_THEANO ยท 5.5 months
Blue-grey. Named after the AI library.
marchel@sys:~$ open ./poster/ICP_2023.pdf --preview
ICP 2023 RESEARCH POSTER โ€” INFORMATICS UTY
ICP 2023 Research Poster โ€” Auto Cat Feeder P-HOG
marchel@sys:~$ cat ./conclusion.txt
CONCLUSION.TXT

The P-HOG + KNN system demonstrates a viable solution for personalized, automated cat feeding.
By recognizing each cat individually, it eliminates manual inconsistency
and provides age-appropriate nutrition with 95% identification accuracy at K=1.

Future work: real-time video stream integration ยท servo motor dispenser ยท mobile app dashboard ยท expanded multi-cat household dataset