getting an error in the kaggle code. I need to rectify the error

29 views Asked by At
img_name extraction
imgs_train = [img for img in image_path if (img.split('/')[-1].split)('.jpg')[0] in xmls_train]
imgs_train[:3]

The output of this is [] (an empty list)

But in this kaggle, they are getting the following output:

#img_name extraction
imgs_train = [img for img in image_path if (img.split('/')[-1].split)('.jpg')[0] in xmls_train]
imgs_train[:3]

['../input/images/images/oil_spot/img_07_425390900_00063.jpg',
 '../input/images/images/oil_spot/img_04_431854700_00385.jpg',
 '../input/images/images/oil_spot/img_08_3437011100_00685.jpg']

I tried all of the following options:

imgs_train = [q.split('/')[-1].split('.')[0] for q in xmls_train]
imgs_train[:3]

imgs_train = [q.split('\\')[-1].split('.jpg')[0]for q in xmls_train ]
imgs_train[:3]

imgs_train = [img for img in xmls_train if (img.split('/')[-1].split)('.jpg')[0]for img in image_path]
imgs_train[:3]

imgs_train = [img for img in image_path if img in xmls_train]
imgs_train[:3]

imgs_train = [img.split("/")[-1].split('.jpg')[0]for img in image_path]
imgs_train[:3]

imgs_train = [img for img in image_path if (img.split('/')[-1].split)('.jpg')[0] in xmls_train]
imgs_train[:3]

imgs_train = [img for img in image_path if (img.split('/')[-1].split)('.jpg')[0] in imgs_train]
imgs_train[:3]
0

There are 0 answers