Datasets:
Tasks:
Image Classification
Formats:
parquet
Sub-tasks:
multi-class-image-classification
Languages:
English
Size:
< 1K
License:
Upload README.md with huggingface_hub
Browse files
README.md
CHANGED
|
@@ -21,38 +21,33 @@ size_categories:
|
|
| 21 |
|
| 22 |
## Dataset Description
|
| 23 |
|
| 24 |
-
This dataset contains 33 images of spotted lanternflies and non-lanternfly subjects, cropped to 224x224 pixels for machine learning model training. The dataset includes both original images and augmented versions created using various data augmentation techniques
|
| 25 |
|
| 26 |
### Dataset Summary
|
| 27 |
|
| 28 |
-
The dataset is designed for training computer vision models to detect spotted lanternflies (Lycorma delicatula), an invasive species that poses a
|
| 29 |
|
| 30 |
### Supported Tasks
|
| 31 |
|
| 32 |
- **Image Classification**: Binary classification to detect presence/absence of spotted lanternflies
|
| 33 |
- **Object Detection**: Can be adapted for bounding box detection tasks
|
| 34 |
-
- **Transfer Learning**: Suitable for fine-tuning pre-trained models
|
| 35 |
|
| 36 |
### Dataset Structure
|
| 37 |
|
| 38 |
-
#### Original Data
|
| 39 |
- **Total Images**: 33
|
| 40 |
- **Has Lanternfly**: 15 images
|
| 41 |
- **No Lanternfly**: 18 images
|
| 42 |
- **Image Size**: 224x224 pixels
|
| 43 |
- **Format**: RGB images in JPG format
|
| 44 |
|
| 45 |
-
|
|
|
|
| 46 |
The dataset includes augmented versions of the original images created using the following techniques:
|
| 47 |
|
| 48 |
1. **Random Rotation**: Images were randomly rotated between 0 and 360 degrees
|
| 49 |
2. **Random Horizontal Flip**: Images had a 50% chance of being flipped horizontally
|
| 50 |
3. **Random Vertical Flip**: Images had a 50% chance of being flipped vertically
|
| 51 |
-
4. **Color Jitter**: Random changes were applied to
|
| 52 |
-
- Brightness (up to 20% variation)
|
| 53 |
-
- Contrast (up to 20% variation)
|
| 54 |
-
- Saturation (up to 20% variation)
|
| 55 |
-
- Hue (up to 10% variation)
|
| 56 |
|
| 57 |
### Data Fields
|
| 58 |
|
|
@@ -66,8 +61,6 @@ The dataset includes augmented versions of the original images created using the
|
|
| 66 |
|
| 67 |
## Usage
|
| 68 |
|
| 69 |
-
### Basic Usage
|
| 70 |
-
|
| 71 |
```python
|
| 72 |
from datasets import load_dataset
|
| 73 |
|
|
@@ -82,172 +75,43 @@ filename = example['filename']
|
|
| 82 |
|
| 83 |
print(f"Label: {label}")
|
| 84 |
print(f"Image size: {image.size}")
|
| 85 |
-
print(f"Image mode: {image.mode}")
|
| 86 |
|
| 87 |
# Display the image
|
| 88 |
image.show()
|
| 89 |
```
|
| 90 |
|
| 91 |
-
### Training a Model
|
| 92 |
-
|
| 93 |
-
```python
|
| 94 |
-
from datasets import load_dataset
|
| 95 |
-
from transformers import AutoImageProcessor, AutoModelForImageClassification
|
| 96 |
-
from torch.utils.data import DataLoader
|
| 97 |
-
import torch
|
| 98 |
-
|
| 99 |
-
# Load dataset
|
| 100 |
-
dataset = load_dataset("rlogh/lanternfly-images", split="original")
|
| 101 |
-
|
| 102 |
-
# Load a pre-trained model
|
| 103 |
-
model_name = "microsoft/resnet-50"
|
| 104 |
-
processor = AutoImageProcessor.from_pretrained(model_name)
|
| 105 |
-
model = AutoModelForImageClassification.from_pretrained(
|
| 106 |
-
model_name,
|
| 107 |
-
num_labels=2,
|
| 108 |
-
id2label={0: "no_lanternfly", 1: "has_lanternfly"},
|
| 109 |
-
label2id={"no_lanternfly": 0, "has_lanternfly": 1}
|
| 110 |
-
)
|
| 111 |
-
|
| 112 |
-
# Process images
|
| 113 |
-
def process_examples(examples):
|
| 114 |
-
images = examples['image']
|
| 115 |
-
labels = [1 if label == "has_lanternfly" else 0 for label in examples['label']]
|
| 116 |
-
|
| 117 |
-
inputs = processor(images, return_tensors="pt")
|
| 118 |
-
inputs['labels'] = torch.tensor(labels)
|
| 119 |
-
return inputs
|
| 120 |
-
|
| 121 |
-
# Apply processing
|
| 122 |
-
processed_dataset = dataset.map(process_examples, batched=True)
|
| 123 |
-
```
|
| 124 |
-
|
| 125 |
-
### Data Augmentation Pipeline
|
| 126 |
-
|
| 127 |
-
The augmentation techniques used in this dataset can be replicated using the following PyTorch transforms:
|
| 128 |
-
|
| 129 |
-
```python
|
| 130 |
-
import torchvision.transforms as transforms
|
| 131 |
-
|
| 132 |
-
# Define augmentation pipeline
|
| 133 |
-
augmentation_pipeline = transforms.Compose([
|
| 134 |
-
transforms.RandomRotation(degrees=360),
|
| 135 |
-
transforms.RandomHorizontalFlip(p=0.5),
|
| 136 |
-
transforms.RandomVerticalFlip(p=0.5),
|
| 137 |
-
transforms.ColorJitter(
|
| 138 |
-
brightness=0.2,
|
| 139 |
-
contrast=0.2,
|
| 140 |
-
saturation=0.2,
|
| 141 |
-
hue=0.1
|
| 142 |
-
),
|
| 143 |
-
transforms.ToTensor(),
|
| 144 |
-
transforms.Normalize(mean=[0.485, 0.456, 0.406], std=[0.229, 0.224, 0.225])
|
| 145 |
-
])
|
| 146 |
-
```
|
| 147 |
-
|
| 148 |
## Dataset Creation
|
| 149 |
|
| 150 |
### Source Data
|
| 151 |
|
| 152 |
Images were collected and manually labeled for the presence or absence of spotted lanternflies. The original images were processed using computer vision techniques to automatically detect and crop around the spotted lanternfly subjects.
|
| 153 |
|
| 154 |
-
### Image Processing Pipeline
|
| 155 |
-
|
| 156 |
-
1. **Object Detection**: Used color-based and edge detection algorithms to identify spotted lanternflies
|
| 157 |
-
2. **Cropping**: Automatically cropped 224x224 pixel regions around detected subjects
|
| 158 |
-
3. **Quality Control**: Manual verification and labeling of all cropped images
|
| 159 |
-
4. **Data Augmentation**: Applied comprehensive augmentation techniques to increase dataset diversity
|
| 160 |
-
|
| 161 |
### Annotations
|
| 162 |
|
| 163 |
-
All images were manually annotated
|
| 164 |
- `has_lanternfly`: Image contains one or more spotted lanternflies
|
| 165 |
- `no_lanternfly`: Image does not contain spotted lanternflies
|
| 166 |
|
| 167 |
-
###
|
| 168 |
|
| 169 |
-
|
| 170 |
-
- **Increase Dataset Size**: Create more training examples from limited original data
|
| 171 |
-
- **Improve Generalization**: Expose models to various orientations and lighting conditions
|
| 172 |
-
- **Reduce Overfitting**: Prevent models from memorizing specific image characteristics
|
| 173 |
-
- **Enhance Robustness**: Make models more resilient to real-world variations
|
| 174 |
|
| 175 |
## Considerations for Using the Data
|
| 176 |
|
| 177 |
### Social Impact of Dataset
|
| 178 |
|
| 179 |
This dataset can be used to develop automated detection systems for spotted lanternflies, which can help in:
|
| 180 |
-
-
|
| 181 |
-
-
|
| 182 |
-
-
|
| 183 |
-
- **Research Applications**: Advancing scientific understanding of invasive species
|
| 184 |
|
| 185 |
### Discussion of Biases
|
| 186 |
|
| 187 |
The dataset may contain biases related to:
|
| 188 |
-
-
|
| 189 |
-
-
|
| 190 |
-
-
|
| 191 |
-
- **Geographic Location**: Limited to specific regions where images were collected
|
| 192 |
-
|
| 193 |
-
### Other Known Limitations
|
| 194 |
-
|
| 195 |
-
- **Limited Dataset Size**: 33 images may be insufficient for complex deep learning models
|
| 196 |
-
- **Single Geographic Region**: May not generalize to other geographic areas
|
| 197 |
-
- **Adult Focus**: Primarily contains adult spotted lanternflies (nymphs may look different)
|
| 198 |
-
- **Manual Labeling**: Subject to human annotation errors and inconsistencies
|
| 199 |
-
|
| 200 |
-
### Recommendations for Use
|
| 201 |
-
|
| 202 |
-
1. **Transfer Learning**: Use pre-trained models and fine-tune on this dataset
|
| 203 |
-
2. **Cross-Validation**: Implement k-fold cross-validation due to limited data
|
| 204 |
-
3. **Additional Augmentation**: Consider applying more augmentation techniques during training
|
| 205 |
-
4. **Ensemble Methods**: Combine multiple models for improved performance
|
| 206 |
-
5. **Data Collection**: Expand the dataset with more diverse images if possible
|
| 207 |
-
|
| 208 |
-
## Performance Benchmarks
|
| 209 |
-
|
| 210 |
-
### Baseline Results
|
| 211 |
-
|
| 212 |
-
When training a ResNet-50 model on this dataset:
|
| 213 |
-
- **Training Accuracy**: ~95% (with augmentation)
|
| 214 |
-
- **Validation Accuracy**: ~85% (with proper train/validation split)
|
| 215 |
-
- **Overfitting**: Significant without data augmentation
|
| 216 |
-
|
| 217 |
-
### Recommended Evaluation Metrics
|
| 218 |
-
|
| 219 |
-
- **Accuracy**: Overall classification accuracy
|
| 220 |
-
- **Precision/Recall**: For both classes
|
| 221 |
-
- **F1-Score**: Balanced measure of precision and recall
|
| 222 |
-
- **Confusion Matrix**: Detailed error analysis
|
| 223 |
-
|
| 224 |
-
## Citation
|
| 225 |
-
|
| 226 |
-
```bibtex
|
| 227 |
-
@dataset{spotted_lanternfly_detection_2024,
|
| 228 |
-
title={Spotted Lanternfly Detection Dataset with Data Augmentation},
|
| 229 |
-
author={Your Name},
|
| 230 |
-
year={2024},
|
| 231 |
-
url={https://huggingface.co/datasets/rlogh/lanternfly-images},
|
| 232 |
-
note={Includes original images and augmented versions with rotation, flipping, and color jitter}
|
| 233 |
-
}
|
| 234 |
-
```
|
| 235 |
|
| 236 |
## License
|
| 237 |
|
| 238 |
-
This dataset is released under the MIT License.
|
| 239 |
-
|
| 240 |
-
## Acknowledgments
|
| 241 |
-
|
| 242 |
-
- Original image collection and labeling
|
| 243 |
-
- Computer vision processing pipeline
|
| 244 |
-
- Data augmentation implementation
|
| 245 |
-
- Hugging Face dataset hosting
|
| 246 |
-
|
| 247 |
-
## Contact
|
| 248 |
-
|
| 249 |
-
For questions or issues with this dataset, please contact [your-email@example.com] or open an issue on the dataset repository.
|
| 250 |
-
|
| 251 |
-
---
|
| 252 |
-
|
| 253 |
-
*This dataset was created to support research and development of automated spotted lanternfly detection systems. Please use responsibly and consider the environmental impact of your applications.*
|
|
|
|
| 21 |
|
| 22 |
## Dataset Description
|
| 23 |
|
| 24 |
+
This dataset contains 33 images of spotted lanternflies and non-lanternfly subjects, cropped to 224x224 pixels for machine learning model training. The dataset includes both original images and augmented versions created using various data augmentation techniques.
|
| 25 |
|
| 26 |
### Dataset Summary
|
| 27 |
|
| 28 |
+
The dataset is designed for training computer vision models to detect spotted lanternflies (Lycorma delicatula), an invasive species that poses a threat to agriculture and ecosystems.
|
| 29 |
|
| 30 |
### Supported Tasks
|
| 31 |
|
| 32 |
- **Image Classification**: Binary classification to detect presence/absence of spotted lanternflies
|
| 33 |
- **Object Detection**: Can be adapted for bounding box detection tasks
|
|
|
|
| 34 |
|
| 35 |
### Dataset Structure
|
| 36 |
|
|
|
|
| 37 |
- **Total Images**: 33
|
| 38 |
- **Has Lanternfly**: 15 images
|
| 39 |
- **No Lanternfly**: 18 images
|
| 40 |
- **Image Size**: 224x224 pixels
|
| 41 |
- **Format**: RGB images in JPG format
|
| 42 |
|
| 43 |
+
### Data Augmentation
|
| 44 |
+
|
| 45 |
The dataset includes augmented versions of the original images created using the following techniques:
|
| 46 |
|
| 47 |
1. **Random Rotation**: Images were randomly rotated between 0 and 360 degrees
|
| 48 |
2. **Random Horizontal Flip**: Images had a 50% chance of being flipped horizontally
|
| 49 |
3. **Random Vertical Flip**: Images had a 50% chance of being flipped vertically
|
| 50 |
+
4. **Color Jitter**: Random changes were applied to brightness (up to 20%), contrast (up to 20%), saturation (up to 20%), and hue (up to 10%) of the images
|
|
|
|
|
|
|
|
|
|
|
|
|
| 51 |
|
| 52 |
### Data Fields
|
| 53 |
|
|
|
|
| 61 |
|
| 62 |
## Usage
|
| 63 |
|
|
|
|
|
|
|
| 64 |
```python
|
| 65 |
from datasets import load_dataset
|
| 66 |
|
|
|
|
| 75 |
|
| 76 |
print(f"Label: {label}")
|
| 77 |
print(f"Image size: {image.size}")
|
|
|
|
| 78 |
|
| 79 |
# Display the image
|
| 80 |
image.show()
|
| 81 |
```
|
| 82 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 83 |
## Dataset Creation
|
| 84 |
|
| 85 |
### Source Data
|
| 86 |
|
| 87 |
Images were collected and manually labeled for the presence or absence of spotted lanternflies. The original images were processed using computer vision techniques to automatically detect and crop around the spotted lanternfly subjects.
|
| 88 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 89 |
### Annotations
|
| 90 |
|
| 91 |
+
All images were manually annotated with binary labels:
|
| 92 |
- `has_lanternfly`: Image contains one or more spotted lanternflies
|
| 93 |
- `no_lanternfly`: Image does not contain spotted lanternflies
|
| 94 |
|
| 95 |
+
### Personal and Sensitive Information
|
| 96 |
|
| 97 |
+
This dataset does not contain any personal or sensitive information.
|
|
|
|
|
|
|
|
|
|
|
|
|
| 98 |
|
| 99 |
## Considerations for Using the Data
|
| 100 |
|
| 101 |
### Social Impact of Dataset
|
| 102 |
|
| 103 |
This dataset can be used to develop automated detection systems for spotted lanternflies, which can help in:
|
| 104 |
+
- Early detection of invasive species
|
| 105 |
+
- Agricultural monitoring and protection
|
| 106 |
+
- Environmental conservation efforts
|
|
|
|
| 107 |
|
| 108 |
### Discussion of Biases
|
| 109 |
|
| 110 |
The dataset may contain biases related to:
|
| 111 |
+
- Lighting conditions in the original images
|
| 112 |
+
- Background environments where lanternflies were photographed
|
| 113 |
+
- Seasonal variations in lanternfly appearance
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 114 |
|
| 115 |
## License
|
| 116 |
|
| 117 |
+
This dataset is released under the MIT License.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|