Bananas Detection
The friendliest object-detection dataset in existence
- train_loader
- val_loader
Object detection is where image classification graduates from "what is in this image?" to "what is in this image, and where?" - and the standard tutorial datasets for that are either enormous (COCO, many GB) or boring (one class of one thing photographed forever). The banana dataset is d2l's answer: a small, purpose-built set of images with bananas and labeled bounding boxes, designed so you can learn the mechanics of detection - anchors, IoU, NMS - without waiting out a giant download. ComfyDL's CdlBananasDetection loads it into training and validation DataLoaders.
Every image contains bananas, and there's exactly one class (banana, index 0), which is precisely the point: with the class problem trivialized, all your attention goes to the harder task of localization. It's the ideal companion to ComfyDL's Object Detection nodes (anchor boxes, IoU, NMS utilities live in the pack for exactly this workflow).
How it works
On first use the node downloads and extracts the banana-detection archive from the d2l data server, then reads the CSV label files that define each image's boxes. Each label row carries (class, upper-left x, upper-left y, lower-right x, lower-right y), and coordinates are stored normalized - divided by 256 - so they work regardless of image size. A custom BananasDataset pairs each image tensor with its box tensor of shape (1, 5) per image (the leading 1 being the single class), and the node wraps those in standard PyTorch DataLoaders: shuffled for training, unshuffled for validation.
Inputs and outputs that matter
batch_size(default 32, up to 256) - samples per batch. That's the one knob.
Outputs:
train_loader,val_loader(bothcdlDataloader) - wire these into your training utilities or the preview/stats nodes.
Because each batch entry is (image, box-tensor), the labels have a 3D-ish structure per batch - that's why ComfyDL's DataLoader Preview recognizes the format and draws the bounding boxes right onto the images. It's a great first thing to try: drop a Bananas Detection node, connect its train_loader to a DataLoader Preview, and watch annotated bananas appear in your graph.
Installing ComfyDL
cd ComfyUI/custom_nodes
git clone https://github.com/Cynthia-lxx/ComfyDL ./ComfyDL
pip install -r ./ComfyDL/requirements.txt
Restart ComfyUI and search "Bananas". ComfyDL's own dependencies are tiny (matplotlib, IPython, matplotlib-inline); the dataset downloads automatically on first use. If ComfyUI Manager doesn't list "ComfyDL" (young pack), the clone route always works.
Gotchas
First-run download, again, is the stall that reads as a hang - the banana archive isn't huge, but it does fetch before anything renders. Data lands in the d2l default ../data folder relative to where ComfyUI was started (typically a sibling folder above the ComfyUI install), not inside ComfyUI/. And remember the single-class caveat when you wire up stats or evaluation: class index is always 0, so a class-distribution chart isn't the interesting output here - box coordinates are.
Inputs (1)
| Name | Type | Default | Description |
|---|---|---|---|
| batch_size | INT | 321–256 | — |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| train_loader | cdlDataloader | — |
| val_loader | cdlDataloader | — |