mxnet-im2rec_tutorial icon indicating copy to clipboard operation
mxnet-im2rec_tutorial copied to clipboard

how to run generate dataset.lst code

Open annabechang opened this issue 6 years ago • 2 comments

hi, thank you for your nice code. i am a newbie in programming, would you please tell me more about how to run the generate dataset.lst code properly? i have image stored under train folder, with images named as id_1_labels_[95, 66, 137, 70, 20].jpg. inside [] are the label of the image. i tried to run the generate dataset.lst code as: python lstgen.py /Users/Anna/.kaggle/competitions/imaterialistchallengefashion2018/train
but the .lst file doesn't look right. thank you for your valuable help.

annabechang avatar May 11 '18 06:05 annabechang

hello , Sorry for my late reply I’m not sure I understand what you mean. you have a image and it named as id_1_labels_[95,66,137,70,20].jpg i think first you should use

from os import listdir
train_path = 'D:/DeepLearning/ ...'  # your training image path
img_name = [f for f in listdir(train_path)]

print(img_name)

and split image_name like this

img_names = 'id_1_labels_[95, 66, 137, 70, 20].jpg'
anno = img_names.split('_')
xywhc = (anno[3].split('.')[0])[1:-1].split(',')
print(anno)
print(xywhc)

if you didn't know the WxH of image ,just use skimage or opencv to open it! and check each shape to normalization

leocvml avatar May 17 '18 03:05 leocvml

I see. and replace the #class with xywhc? Thank you for such detailed explanation!

annabechang avatar May 18 '18 12:05 annabechang