Introduction
Public health surveillance has increasingly turned to social media platforms like Instagram to monitor emerging tobacco product trends and user behaviors. However, the sheer volume of image-based data presents a significant bottleneck, as traditional analysis relies on manual hand-coding by researchers. This manual process is slow, costly, and limits the scope of large-scale studies. To address this, we present a hybrid machine learning pipeline designed to automatically identify images containing hookahs (waterpipes) with high precision.
Methodology
The core of the proposed system is a hybrid approach that combines the feature extraction capabilities of Convolutional Neural Networks (CNNs) with the robust classification performance of Support Vector Machines (SVMs).
Feature Extraction via Transfer Learning
Rather than training a deep network from scratch, which requires massive datasets and computational resources, the study utilizes transfer learning. A pre-trained AlexNet model, consisting of 25 layers and originally trained on the ImageNet dataset, serves as the feature extractor.
The network was fine-tuned by removing the final two layers. Instagram images were processed through the remaining layers, and the output of the final fully connected layer was captured as a 4096-dimensional feature vector. This vector represents a high-level, dense encoding of the image's visual content.
Classification
The extracted feature vectors were then used to train an SVM classifier. The SVM was optimized to find the hyperplane that best separates images containing hookahs from those that do not. Hyperparameters, including the learning rate and mini-batch size, were automatically tuned to maximize classification accuracy.
Dataset and Experimental Setup
The dataset comprised 840 images scraped from Instagram using the hashtag #hookah between February and May 2016. Ground truth labels were established through manual categorization into "hookah" and "non-hookah" classes. The dataset was balanced, with 420 images in each category. For the experiment, the data was split 50/50 into training and testing sets (420 images each).
Results
The CNN+SVM pipeline demonstrated exceptional performance, achieving an overall accuracy of 99.5% on the test set. Specifically:
- Non-hookah classification: 100% accuracy (zero false positives).
- Hookah classification: 99.1% accuracy (two false negatives out of 210).
Learning curve analysis indicated that the model's performance improved significantly as the training data volume increased, particularly after utilizing 80% of the training set, suggesting the model's capacity to scale effectively with larger datasets.
Discussion and Conclusion
The results highlight the effectiveness of transfer learning for niche domain tasks in public health. By leveraging a general-purpose network like AlexNet, the system could extract sophisticated visual features sufficient for identifying specific objects like waterpipes without domain-specific pre-training.
The hybrid CNN+SVM approach outperformed standalone models by delegating complex visual processing to the CNN while utilizing the SVM for optimal decision boundary construction. This automated pipeline enables public health officials to monitor social media at scale, facilitating the detection of marketing trends, product popularity spikes, and co-use patterns that were previously inaccessible through manual methods. Future work will focus on expanding the model to multi-class classification and larger, more diverse datasets across different social media platforms.
Summary updated