Not seeing images for labelling in interactive mode #157
-
Hi guys, I was trying to use finetuner to build a CBIR system and followed this starter but was getting the above error. Environment Details: python3.8 with torch and finetuner installed. Would be grateful if someone can clarify this earnestly. Thanks, |
Beta Was this translation helpful? Give feedback.
Replies: 5 comments 9 replies
-
hi @ElisonSherton i just runned the same code in my mac, I can not reproduce, can you try to install the latest jina using also, can you check you have converted datauri to blob in def data_gen():
for d in from_files('/Users/bo/Downloads/img_align_celeba/*.jpg', size=100, to_dataturi=True):
d.convert_image_datauri_to_blob(color_axis=0)
yield d and please make sure the data path you send to |
Beta Was this translation helpful? Give feedback.
-
i think the problem is not about the path, it complains about the data size, so I think your image size is not something that ResNet appreciate. ResNet accepts only |
Beta Was this translation helpful? Give feedback.
-
aha, okay i see what you mean, actually
No need, let me try something and get back to you |
Beta Was this translation helpful? Give feedback.
-
hi @ElisonSherton i'm guessing your images are in different sizes right? the first image's size is different than the second, and third, etc. |
Beta Was this translation helpful? Give feedback.
-
@vahuja4 this is solved, and here is how you can use images of different sizes.
from jina.types.document.generators import from_files
def data_gen():
for d in from_files('/Users/hanxiao/Documents/tmpimg/*.jpg'):
d.convert_image_uri_to_blob()
d.convert_uri_to_datauri()
d.resize_image_blob(224, 224)
d.normalize_image_blob()
d.set_image_blob_channel_axis(-1, 0)
yield d
import torchvision
import finetuner
model = torchvision.models.resnet50(pretrained=True)
finetuner.fit(
model=model,
interactive=True,
train_data=data_gen,
freeze=True,
to_embedding_model=True,
input_size=(3, 224, 224),
output_dim=100, # Chop-off the last fc layer and add a trainable linear layer.
) |
Beta Was this translation helpful? Give feedback.
@vahuja4 this is solved, and here is how you can use images of different sizes.
pip install -U finetuner