Guest User

Untitled

a guest
Jan 19th, 2019
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.67 KB | None | 0 0
  1. from .base import *
  2. import scipy.io
  3.  
  4. class Cars(BaseDataset):
  5. def __init__(self, root, classes, transform = None):
  6. BaseDataset.__init__(self, root, classes, transform)
  7. annos_fn = 'cars_annos.mat'
  8. cars = scipy.io.loadmat(os.path.join(root, annos_fn))
  9. ys = [int(a[5][0] - 1) for a in cars['annotations'][0]]
  10. im_paths = [a[0][0] for a in cars['annotations'][0]]
  11. index = 0
  12. for im_path, y in zip(im_paths, ys):
  13. if y in classes: # choose only specified classes
  14. self.im_paths.append(os.path.join(root, im_path))
  15. self.ys.append(y)
  16. self.I += [index]
  17. index += 1
Add Comment
Please, Sign In to add comment