Dataset Viewer
Auto-converted to Parquet
The dataset viewer is not available for this split.
Cannot load the dataset split (in streaming mode) to extract the first rows.
Error code:   StreamingRowsError
Exception:    CastError
Message:      Couldn't cast
image_path: string
label: string
filename: string
-- schema metadata --
huggingface: '{"info": {"features": {"image_path": {"dtype": "string", "_' + 117
to
{'image': Image(mode=None, decode=True), 'label': Value('string'), 'filename': Value('string')}
because column names don't match
Traceback:    Traceback (most recent call last):
                File "/src/services/worker/src/worker/utils.py", line 99, in get_rows_or_raise
                  return get_rows(
                File "/src/libs/libcommon/src/libcommon/utils.py", line 272, in decorator
                  return func(*args, **kwargs)
                File "/src/services/worker/src/worker/utils.py", line 77, in get_rows
                  rows_plus_one = list(itertools.islice(ds, rows_max_number + 1))
                File "/src/services/worker/.venv/lib/python3.9/site-packages/datasets/iterable_dataset.py", line 2361, in __iter__
                  for key, example in ex_iterable:
                File "/src/services/worker/.venv/lib/python3.9/site-packages/datasets/iterable_dataset.py", line 1882, in __iter__
                  for key, pa_table in self._iter_arrow():
                File "/src/services/worker/.venv/lib/python3.9/site-packages/datasets/iterable_dataset.py", line 1905, in _iter_arrow
                  for key, pa_table in self.ex_iterable._iter_arrow():
                File "/src/services/worker/.venv/lib/python3.9/site-packages/datasets/iterable_dataset.py", line 499, in _iter_arrow
                  for key, pa_table in iterator:
                File "/src/services/worker/.venv/lib/python3.9/site-packages/datasets/iterable_dataset.py", line 346, in _iter_arrow
                  for key, pa_table in self.generate_tables_fn(**gen_kwags):
                File "/src/services/worker/.venv/lib/python3.9/site-packages/datasets/packaged_modules/parquet/parquet.py", line 106, in _generate_tables
                  yield f"{file_idx}_{batch_idx}", self._cast_table(pa_table)
                File "/src/services/worker/.venv/lib/python3.9/site-packages/datasets/packaged_modules/parquet/parquet.py", line 73, in _cast_table
                  pa_table = table_cast(pa_table, self.info.features.arrow_schema)
                File "/src/services/worker/.venv/lib/python3.9/site-packages/datasets/table.py", line 2272, in table_cast
                  return cast_table_to_schema(table, schema)
                File "/src/services/worker/.venv/lib/python3.9/site-packages/datasets/table.py", line 2218, in cast_table_to_schema
                  raise CastError(
              datasets.table.CastError: Couldn't cast
              image_path: string
              label: string
              filename: string
              -- schema metadata --
              huggingface: '{"info": {"features": {"image_path": {"dtype": "string", "_' + 117
              to
              {'image': Image(mode=None, decode=True), 'label': Value('string'), 'filename': Value('string')}
              because column names don't match

Need help to make the dataset viewer work? Make sure to review how to configure the dataset viewer, and open a discussion for direct support.

Spotted Lanternfly Detection Dataset

Dataset Description

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 to improve model robustness and generalization.

Dataset Summary

The dataset is designed for training computer vision models to detect spotted lanternflies (Lycorma delicatula), an invasive species that poses a significant threat to agriculture and ecosystems. The dataset includes comprehensive data augmentation to enhance model performance and reduce overfitting.

Supported Tasks

  • Image Classification: Binary classification to detect presence/absence of spotted lanternflies
  • Object Detection: Can be adapted for bounding box detection tasks
  • Transfer Learning: Suitable for fine-tuning pre-trained models

Dataset Structure

Original Data

  • Total Images: 33
  • Has Lanternfly: 15 images
  • No Lanternfly: 18 images
  • Image Size: 224x224 pixels
  • Format: RGB images in JPG format

Augmented Data

The dataset includes augmented versions of the original images created using the following techniques:

  1. Random Rotation: Images were randomly rotated between 0 and 360 degrees
  2. Random Horizontal Flip: Images had a 50% chance of being flipped horizontally
  3. Random Vertical Flip: Images had a 50% chance of being flipped vertically
  4. Color Jitter: Random changes were applied to:
    • Brightness (up to 20% variation)
    • Contrast (up to 20% variation)
    • Saturation (up to 20% variation)
    • Hue (up to 10% variation)

Data Fields

  • image: RGB image (224x224 pixels) as PIL Image object
  • label: String label ("has_lanternfly" or "no_lanternfly")
  • filename: Original filename of the image

Data Splits

  • original: All 33 images (no train/test split provided)

Usage

Basic Usage

from datasets import load_dataset

# Load the dataset
dataset = load_dataset("rlogh/lanternfly-images", split="original")

# View a sample
example = dataset[0]
image = example['image']  # PIL Image object
label = example['label']
filename = example['filename']

print(f"Label: {label}")
print(f"Image size: {image.size}")
print(f"Image mode: {image.mode}")

# Display the image
image.show()

Training a Model

from datasets import load_dataset
from transformers import AutoImageProcessor, AutoModelForImageClassification
import torch

# Load dataset
dataset = load_dataset("rlogh/lanternfly-images", split="original")

# Load a pre-trained model
model_name = "microsoft/resnet-50"
processor = AutoImageProcessor.from_pretrained(model_name)
model = AutoModelForImageClassification.from_pretrained(
    model_name, 
    num_labels=2,
    id2label={0: "no_lanternfly", 1: "has_lanternfly"},
    label2id={"no_lanternfly": 0, "has_lanternfly": 1}
)

Dataset Creation

Source Data

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.

Image Processing Pipeline

  1. Object Detection: Used color-based and edge detection algorithms to identify spotted lanternflies
  2. Cropping: Automatically cropped 224x224 pixel regions around detected subjects
  3. Quality Control: Manual verification and labeling of all cropped images
  4. Data Augmentation: Applied comprehensive augmentation techniques to increase dataset diversity

Annotations

All images were manually annotated by domain experts with binary labels:

  • has_lanternfly: Image contains one or more spotted lanternflies
  • no_lanternfly: Image does not contain spotted lanternflies

Personal and Sensitive Information

This dataset does not contain any personal or sensitive information.

Considerations for Using the Data

Social Impact of Dataset

This dataset can be used to develop automated detection systems for spotted lanternflies, which can help in:

  • Early Detection: Identifying invasive species before they spread
  • Agricultural Monitoring: Protecting crops and agricultural resources
  • Environmental Conservation: Supporting ecosystem health and biodiversity
  • Research Applications: Advancing scientific understanding of invasive species

Discussion of Biases

The dataset may contain biases related to:

  • Lighting Conditions: Variations in natural lighting during image capture
  • Background Environments: Different settings where lanternflies were photographed
  • Seasonal Variations: Changes in lanternfly appearance across seasons
  • Geographic Location: Limited to specific regions where images were collected

Other Known Limitations

  • Limited Dataset Size: 33 images may be insufficient for complex deep learning models
  • Single Geographic Region: May not generalize to other geographic areas
  • Adult Focus: Primarily contains adult spotted lanternflies (nymphs may look different)
  • Manual Labeling: Subject to human annotation errors and inconsistencies

AI-Assisted Development

This dataset and its associated code were developed with the assistance of AI as a coding co-pilot. The AI helped with:

  • Image processing and cropping algorithms
  • Data augmentation implementation
  • Dataset formatting and upload to Hugging Face
  • Code optimization and error handling

The human developer maintained full control over the dataset design, labeling decisions, and final implementation, with AI serving as a collaborative tool to accelerate the development process.

Citation

@dataset{spotted_lanternfly_detection_2024,
  title={Spotted Lanternfly Detection Dataset with Data Augmentation},
  author={Your Name},
  year={2024},
  url={https://huggingface.co/datasets/rlogh/lanternfly-images},
  note={Includes original images and augmented versions with rotation, flipping, and color jitter}
}

License

This dataset is released under the MIT License. You are free to use, modify, and distribute this dataset for both commercial and non-commercial purposes.

Downloads last month
25