-
I'm just getting to grips with the library and the codebase, all looks great so far. I'm trying to train on COCO just to verify my understanding. However I'm running into the error: The code itself is fairly minimal: import yolort
import torch
import torchvision
import pytorch_lightning as pl
import yolort.trainer
import os
from PIL import Image
import yolort.data.transforms as T
import yolort.data.data_module
lightning_task = yolort.trainer.lightning_task.DefaultTask(num_classes=80)
def get_transform(train):
transforms = []
transforms.append(T.PILToTensor())
transforms.append(T.ConvertImageDtype(torch.float))
if train:
transforms.append(T.RandomHorizontalFlip(0.5))
return T.Compose(transforms)
dataset = yolort.data.coco.COCODetection("<path to>/Downloads/val2017/",
"<path to>/Downloads/annotations/instances_val2017.json",
get_transform(train=False))
train_dataset, val_dataset = torch.utils.data.random_split(dataset, [4500, 500])
detection_data_module = yolort.data.data_module.DetectionDataModule(train_dataset=train_dataset,
val_dataset=val_dataset)
trainer = pl.Trainer(max_epochs=2,
log_every_n_steps=10
)
trainer.fit(lightning_task,
train_dataloaders=detection_data_module.train_dataloader(),
val_dataloaders=detection_data_module.val_dataloader()) The Am I missing something? Is there a minimal training example available somewhere? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
This appears to have been fixed by installing
Cloning the repo and then running |
Beta Was this translation helpful? Give feedback.
This appears to have been fixed by installing
yolort
from GitHub rather than runningpip install -U yolort
.pip install -U yolort
installedyolort == 0.6.3
on my machine.Cloning the repo and then running
pip install -e .
appears to have resolved the error I was seeing