Hi @KlemenSkrlj ,
I’m trying to auto-annotate a new batch of images. I noticed that the same config and model weights work well for older image directories, but they don’t seem to work on the images I downloaded today. Here’s the error log I’m seeing. I’m a bit confused about why this is happening — could you please help me troubleshoot?
INFO Loaded checkpoint from [luxonis_lightning.py](file:///home/nileena/.conda/envs/luxonis-train/lib/python3.10/site-packages/luxonis_train/lightning/luxonis_lightning.py):[608](file:///home/nileena/.conda/envs/luxonis-train/lib/python3.10/site-packages/luxonis_train/lightning/luxonis_lightning.py#608)
/home/nileena/datascience-computer-vision/seafman/luxonis_train_can_defect_detect
ion/depthai-ml-training/training/output/19oct2025_allclasses_300epoch/best_val_me
tric/can_detection_15oct_3angle_augmented_EfficientBBoxHead_MeanAveragePrecision=
\*\*0.\*\*8215_loss=\*\*3.\*\*3505_139.ckpt.
$$
INFO Deleting local dataset 'infer_from_directory' from local storage luxonis_dataset.py:950
$$
$$
INFO Adding data to dataset 'infer_from_directory'... luxonis_dataset.py:1052
$$
$$
INFO Generating UUIDs... luxonis_dataset.py:1006
$$
$$
INFO Checking arrays... luxonis_dataset.py:972
$$
$$
WARNING /home/nileena/.conda/envs/luxonis-train/lib/python3.10/site-packages/rich/live.py:231: logging.py:104
UserWarning: install "ipywidgets" for Jupyter support
warnings.warn('install "ipywidgets" for Jupyter support')
$$
$$
$$
$$
INFO Saving annotations... luxonis_dataset.py:1039
$$
$$
$$
$$
INFO Detected new classes for task group '': [] luxonis_dataset.py:1143
$$
$$
WARNING Metadata labels detected. Metadata labels can contain arbitrary data so they albumentations_engine.py:319
cannot be properly augmented. The only applied transformation is discarding
metadata associated with bboxes falling outside the image.
$$
$$
INFO Deleting local dataset 'false_negatives_from_conveyor_auto_annotated' from local luxonis_dataset.py:950
storage
$$
$$
INFO Adding data to dataset 'false_negatives_from_conveyor_auto_annotated'... luxonis_dataset.py:1052
$$
$$
WARNING /home/nileena/.local/lib/python3.10/site-packages/torch/cuda/__init__.py:789: UserWarning: logging.py:104
Can't initialize NVML
warnings.warn("Can't initialize NVML")
$$
$$
WARNING /home/nileena/.local/lib/python3.10/site-packages/torch/utils/data/dataloader.py:665: logging.py:104
UserWarning: 'pin_memory' argument is set as true but no accelerator is found, then device
pinned memory won't be used.
warnings.warn(warn_msg)
$$
$$
╭─────────────────────────────── Traceback (most recent call last) ────────────────────────────────╮
│ in <module>:6 │
│ │
│ 3 # test_dir = "/home/nileena/incomplete_conveyor_16july_testset" │
│ 4 output_dir = "false_negatives_from_conveyor_auto_annotated" │
│ 5 │
│ ❱ 6 luxonis_model.annotate(dir_path=test_dir,dataset_name=output_dir,weights=weights) │
│ 7 │
│ │
│ /home/nileena/.conda/envs/luxonis-train/lib/python3.10/site-packages/luxonis_train/core/core.py: │
│ 644 in annotate │
│ │
│ 641 │ │ │ │ │ for f in dir_path.iterdir() │
│ 642 │ │ │ │ │ if f.suffix.lower() in IMAGE_FORMATS │
│ 643 │ │ │ │ ) │
│ ❱ 644 │ │ │ │ annotated_dataset = annotate_from_directory( │
│ 645 │ │ │ │ │ self, │
│ 646 │ │ │ │ │ image_files, │
│ 647 │ │ │ │ │ dataset_name, │
│ │
│ /home/nileena/.conda/envs/luxonis-train/lib/python3.10/site-packages/luxonis_train/core/utils/an │
│ notate_utils.py:61 in annotate_from_directory │
│ │
│ 58 │ ) │
│ 59 │ │
│ 60 │ generator = annotated_dataset_generator(model, loader) │
│ ❱ 61 │ annotated_dataset.add(generator) │
│ 62 │ annotated_dataset.make_splits() │
│ 63 │ luxonis_loader = loader.dataset │
│ 64 │ assert isinstance(luxonis_loader, LuxonisLoaderTorch) │
│ │
│ /home/nileena/.conda/envs/luxonis-train/lib/python3.10/site-packages/luxonis_ml/data/datasets/lu │
│ xonis_dataset.py:1074 in add │
│ │
│ 1071 │ │ assert annotations_path is not None │
│ 1072 │ │ │
│ 1073 │ │ with ParquetFileManager(annotations_path, batch_size) as pfm: │
│ ❱ 1074 │ │ │ for i, record in enumerate(generator, start=1): │
│ 1075 │ │ │ │ if not isinstance(record, DatasetRecord): │
│ 1076 │ │ │ │ │ record = DatasetRecord(**record) │
│ 1077 │ │ │ │ ann = record.annotation │
│ │
│ /home/nileena/.conda/envs/luxonis-train/lib/python3.10/site-packages/luxonis_train/core/utils/an │
│ notate_utils.py:79 in annotated_dataset_generator │
│ │
│ 76 │ │
│ 77 │ lt_module = model.lightning_module.eval() │
│ 78 │ │
│ ❱ 79 │ for batch in loader: │
│ 80 │ │ imgs, metas = batch │
│ 81 │ │ with torch.no_grad(): │
│ 82 │ │ │ batch_out = lt_module(imgs).outputs │
│ │
│ /home/nileena/.local/lib/python3.10/site-packages/torch/utils/data/dataloader.py:733 in __next__ │
│ │
│ /home/nileena/.local/lib/python3.10/site-packages/torch/utils/data/dataloader.py:789 in │
│ _next_data │
│ │
│ /home/nileena/.local/lib/python3.10/site-packages/torch/utils/data/_utils/fetch.py:55 in fetch │
│ │
│ /home/nileena/.local/lib/python3.10/site-packages/torch/utils/data/_utils/collate.py:398 in │
│ default_collate │
│ │
│ /home/nileena/.local/lib/python3.10/site-packages/torch/utils/data/_utils/collate.py:211 in │
│ collate │
│ │
│ /home/nileena/.local/lib/python3.10/site-packages/torch/utils/data/_utils/collate.py:212 in │
│ <listcomp> │
│ │
│ /home/nileena/.local/lib/python3.10/site-packages/torch/utils/data/_utils/collate.py:171 in │
│ collate │
│ │
│ /home/nileena/.local/lib/python3.10/site-packages/torch/utils/data/_utils/collate.py:172 in │
│ <dictcomp> │
│ │
│ /home/nileena/.local/lib/python3.10/site-packages/torch/utils/data/_utils/collate.py:155 in │
│ collate │
│ │
│ /home/nileena/.local/lib/python3.10/site-packages/torch/utils/data/_utils/collate.py:272 in │
│ collate_tensor_fn │
╰──────────────────────────────────────────────────────────────────────────────────────────────────╯
RuntimeError: stack expects each tensor to be equal size, but got [62] at entry 0 and [61] at entry 2
$$