Inspiration
Farmers often struggle to identify cattle skin diseases early, which leads to delayed treatment, reduced productivity, and financial losses. Limited access to veterinarians in rural areas inspired us to build an AI tool that can diagnose cattle skin diseases instantly from images, giving farmers a reliable assistant they can carry in their pocket.
What it does
CattleGuard AI uses a CNN-based deep learning model to diagnose cattle skin diseases in real time using images. It provides: \begin{itemize} \item Instant and reliable disease prediction \item Early alerts for treatment \item Reduced spread of infections \item Accessible livestock healthcare without expert intervention \end{itemize}
How we built it
\subsection*{1. Dataset Preparation} \begin{itemize} \item Images organized into disease-specific folders \item A dataframe created mapping image paths to labels \item Labels encoded using \texttt{LabelEncoder} \end{itemize}
\subsection*{2. Data Generators} Using \texttt{ImageDataGenerator}, we: \begin{itemize} \item Normalized pixel values \item Generated augmented training samples \item Created train, validation, and test pipelines \end{itemize}
\subsection*{3. Model Development (MobileNetV2)} We used MobileNetV2 (\texttt{weights = 'imagenet'}, \texttt{include_top = false}) as the feature extractor due to its efficiency and strong performance on mobile-friendly tasks.
On top of the backbone, we added: \begin{itemize} \item Global Average Pooling layer \item Dense layer with ReLU activation \item Batch Normalization \item Dropout for regularization \item Final Dense Softmax layer for multi-class classification \end{itemize}
The base model was frozen, and only the classifier head was trained.
\subsection*{4. Training Strategy} \begin{itemize} \item Adam optimizer with learning rate $1 \times 10^{-4}$ \item Class weights to handle dataset imbalance \item EarlyStopping to prevent overfitting \item ReduceLROnPlateau for dynamic learning rate adjustment \item ModelCheckpoint to save the best weights \end{itemize}
\subsection*{5. Evaluation & Saving} \begin{itemize} \item Classification report on test data \item Confusion matrix visualization \item Saved trained model (.h5) and label encoder (.pkl) \end{itemize}
Challenges we ran into
\subsection*{1. Dataset Imbalance}
Some diseases had very few images.
\textbf{Solution:} Applied class weights and augmentation.
\subsection*{2. Overfitting}
Initial models overfit quickly.
\textbf{Solution:} Dropout, early stopping, and batch normalization.
\subsection*{3. Noisy Images}
Variation in lighting, orientation, and resolution.
\textbf{Solution:} Strong augmentation and normalization.
\subsection*{4. Computational Constraints}
Training deeper models like ResNet50 was slow.
\textbf{Solution:} MobileNetV2 provided the perfect speed–accuracy balance.
Accomplishments that we're proud of
\begin{itemize} \item Built a full end-to-end disease classification pipeline \item Achieved strong accuracy using a mobile-friendly model \item Designed a system that works in real-world rural conditions \item Created a lightweight and deployable AI solution \end{itemize}
What we learned
\subsection*{Deep Learning & Transfer Learning} Understanding MobileNetV2, frozen feature extraction, and fine-tuning principles.
\subsection*{Image Processing Techniques} Data augmentation, normalization, dataset structuring.
\subsection*{Evaluation Knowledge} Confusion matrix, precision, recall, F1-score, learning-rate scheduling.
\subsection*{Mathematical Concepts} Softmax: [ \hat{y} = \text{softmax}(Wx + b) ]
Categorical cross-entropy loss: [ \mathcal{L} = -\sum y_i \log(\hat{y_i}) ]
What's next for CattleGuard AI
\begin{itemize} \item Deploy a mobile app for real-time diagnosis \item Expand dataset to include more diseases \item Enable offline inference for low-connectivity regions \item Add Grad-CAM for explainability \item Provide automated veterinary recommendations \end{itemize}
Log in or sign up for Devpost to join the conversation.