removed unused packages
This commit is contained in:
@@ -15,7 +15,7 @@ from torchvision.transforms.functional import (
|
||||
to_tensor,
|
||||
)
|
||||
|
||||
from shared.datastore import Datastore
|
||||
from shared.repositories import ImageRepository
|
||||
|
||||
# resnet18 original normalization values
|
||||
RESNET_NORMALIZE_MEAN = [0.485, 0.456, 0.406]
|
||||
@@ -27,13 +27,11 @@ class VCDADataset(Dataset):
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
datastore: Datastore,
|
||||
data_name_list: list[str],
|
||||
do_augment: bool = False,
|
||||
random_annotations: bool = False,
|
||||
):
|
||||
super().__init__()
|
||||
self.datastore = datastore
|
||||
self.data_name_list = data_name_list
|
||||
self.do_augment = do_augment
|
||||
self.random_annotations = random_annotations
|
||||
@@ -55,11 +53,11 @@ class VCDADataset(Dataset):
|
||||
|
||||
def __getitem__(self, idx):
|
||||
# get image from database
|
||||
object_name = self.data_name_list[idx]
|
||||
image = self.datastore.get_image(
|
||||
object_name=object_name,
|
||||
)
|
||||
tensor = self.image_to_tensor(image)
|
||||
image_name = self.data_name_list[idx]
|
||||
with ImageRepository() as repo:
|
||||
image_data = repo.get_data(image_name)
|
||||
assert image_data is not None
|
||||
tensor = self.image_to_tensor(image_data.image)
|
||||
if self.do_augment:
|
||||
tensor = self.augment(tensor)
|
||||
return tensor
|
||||
|
||||
Reference in New Issue
Block a user