--- pretty_name: corn1000 — counted cereal kernels on A4 license: cc-by-nc-4.0 language: - en size_categories: - n<1K tags: - agriculture - counting - object-counting - cereal - grain - thousand-kernel-weight configs: - config_name: default data_files: - split: train path: data/train/** - split: test path: data/test/** --- # corn1000 — counted cereal kernels on A4 Photos of cereal kernels spread on a white A4 sheet, each labelled with the **exact number of kernels** on the sheet. The dataset is built to train models that count kernels from a single phone photo, as the first step of estimating the thousand-kernel weight (TKW = mass ÷ count × 1000). A 1 % count error is a 1 % TKW error, so the collection protocol is built around label correctness. ## Contents | | | |---|---| | Images | 836 | | Arrangements (distinct kernel layouts) | 128 | | Kernels per image | 170 – 1000 | | Images with point annotations | 158 | | Session | Species | Pollution | Cameras | Images | Arrangements | Kernels | |---|---|---|---|---|---|---| | S02 | oats-s | none | Galaxy S23, iPhone 8 | 124 | 31 | 240–798 | | S03 | barley-w | light | Galaxy S23, Galaxy Tab S6 Lite, iPhone 8 | 231 | 28 | 225–733 | | S04 | wheat-w | light | Galaxy Tab S6 Lite, Pixel 9 | 131 | 33 | 170–800 | | S05 | durum-w | light | Galaxy S23, iPhone 8 | 265 | 31 | 230–782 | | count_1000 | barley-w, durum-w, rye-w, wheat-w, oats-s | light, none | Galaxy S23, iPhone 8 | 85 | 5 | 1000–1000 | ## Fields | Column | Meaning | |---|---| | `image` | The photo. JPEG; see *Orientation* below. | | `count` | Number of kernels on the sheet — the label. | | `arrangement_id` | One physical layout of kernels (`-[-]`). Every arrangement is photographed several times, see *Splitting*. | | `session`, `step`, `take` | Session ID, card number within the session, and re-shoot number after a REDO. | | `species` | `rye-w` winter rye, `durum-w` winter durum wheat, `barley-w` winter barley, `oats-s` spring oats, `wheat-w` winter soft wheat. | | `pollution` | `none`, `light` or `heavy`: amount of chaff, awns, broken kernels, pebbles, dust or office materials mixed in. **Never counted.** | | `camera` | Camera model from EXIF. | | `taken_at` | Capture time from EXIF (camera clock, no time zone). | | `raw_file` | Path of the original raw file in this repo (`raw/…`) if the photo was shot as DNG; else empty. | | `kernel_points` | `[x, y]` of every counted kernel, see *Point annotations*; null if the photo is not annotated. | | `broken_points` | `[x, y]` of broken kernels (not counted); null if not annotated. | | `invalid_points` | `[x, y]` of other objects marked as not countable; null if not annotated. | ## How it was collected ### Counting rules Based on ISO 520:2010. **Counts as a kernel:** an intact kernel, including shrivelled and small ones. Barley and oats count with their husk. Twins count as two kernels. **Never counts:** broken kernels; chaff, straw and awns; foreign seeds, dust and stones. Borderline cases were sorted out rather than judged, to keep the count exact. **Pollution in the data:** chaff, awns, broken kernels, pebbles, dust or office materials will occur in the use case, so some sessions deliberately contain them as noise (`pollution` = `light` or `heavy`). They are never part of `count`. ### Materials - White A4 sheet on a dark or high-contrast background - Cups for the kernels, each holding a verified 50 kernels - Printed session cards and special cards (REDO, INVALIDATE) from the planning script ### Sessions - **S02:** spring oats (`oats-s`), not polluted; Galaxy S23 and iPhone 8; 2026-10-02. - **S03:** winter barley (`barley-w`), lightly polluted; Galaxy S23 (shot as DNG), iPhone 8 and Galaxy Tab S6 Lite; shot over three days, 2026-09-16 to 09-21. - **S04:** winter soft wheat (`wheat-w`), lightly polluted; Pixel 9 and Galaxy Tab S6 Lite; 2026-10-15. The tablet missed or misdated the photos of cards 0, 3, 8, 14 and 15; its photos of those layouts were placed on the card by hand and checked against the Pixel photos. - **S05:** winter durum wheat (`durum-w`), lightly polluted; Galaxy S23 (shot as DNG) and iPhone 8; 2026-10-15. - **count_1000:** the `test` split. All five species with exactly 1000 kernels in every photo, 13–21 photos per species; barley lightly polluted, the others not polluted; Galaxy S23 (shot as DNG) and iPhone 8; 2026-10-26. No session cards were photographed: the species were assigned by capture time and checked by eye, and each species is one `arrangement_id`. ## Splitting Images are **not independent**: every arrangement appears in 2–22 photos (several phones, several angles), and consecutive arrangements of a session share most of their kernels. Split by `session`; never by image, and never by `arrangement_id` alone. The `test` split is session `count_1000` (see *Sessions*); `train` holds all other sessions. ## Loading ```python from datasets import load_dataset ds = load_dataset("SmartFarmingLab/corn1000") ``` **Orientation:** most JPEGs are stored sideways with an EXIF orientation tag, exactly as the phones wrote them. `datasets`, browsers and `cv2.imread` apply the tag; plain `PIL.Image.open` does not — call `PIL.ImageOps.exif_transpose` after it. **Raw photos:** some phones shot DNG. For those, the image in `data/` was developed with LibRaw (rawpy, camera white balance, full resolution, JPEG quality 95). The originals are in `raw/`, linked by `raw_file`. Colours of developed DNGs differ from the phones' own JPEG processing. ## Point annotations A subset of photos carries one point per object, placed by hand in CVAT. Coordinates are pixels of the **upright** image, i.e. after the EXIF orientation is applied (what `datasets` returns), with the origin at the top left. The points are a second, independent annotation: `len(kernel_points)` can differ from `count` by a few kernels, mostly on dense sheets where a kernel was missed or lies at the edge of the frame. `count` stays the label. ## Known limitations - Only the species in the table above so far. - Some sessions contain pollution (`pollution` ≠ `none`). It is visible in the photos and deliberately not part of the count. ## License [CC BY-NC 4.0](https://creativecommons.org/licenses/by-nc/4.0/): free to use and adapt for non-commercial purposes with attribution. For commercial use, contact the Smart Farming Lab (Universität Leipzig). ## Citation No publication yet.