liuruijin17 / LSTR

This is an official repository of End-to-end Lane Shape Prediction with Transformers.
BSD 3-Clause "New" or "Revised" License
647 stars 130 forks source link

cannot load xx.pkl #52

Closed happyLifeAndWorking closed 3 years ago

happyLifeAndWorking commented 3 years ago
I just follow the instruction to test LSTR, but I got this error(I just copy the cache/nnet/LSTR/LSTR_500000.pkl --> cache/tusimple_['test_label'].pkl ):

(lstr) xxxxxxxxx:~/work/lane/TuSimple/LSTR$ python test.py LSTR --testiter 500000 --modality eval --split testing cfgfile: ./config/LSTR.json loading all datasets... split: test loading from cache file: ./cache/tusimple['test_label'].pkl Traceback (most recent call last): File "test.py", line 122, in testing_db = datasets[dataset](configs["db"], split) File "/home/yyang/work/lane/TuSimple/LSTR/db/tusimple.py", line 113, in init self._load_data() File "/home/yyang/work/lane/TuSimple/LSTR/db/tusimple.py", line 136, in _load_data self.max_points) = pickle.load(f) TypeError: 'int' object is not iterable

then I try to use torch to load it, I got error as following: (lstr) xxxxxxxxx:~/work/lane/TuSimple/LSTR$ python test.py LSTR --testiter 500000 --modality eval --split testing cfgfile: ./config/LSTR.json loading all datasets... split: test loading from cache file: ./cache/tusimple['test_label'].pkl Traceback (most recent call last): File "test.py", line 122, in testing_db = datasets[dataset](configs["db"], split) File "/home/yyang/work/lane/TuSimple/LSTR/db/tusimple.py", line 114, in init self._load_data() File "/home/yyang/work/lane/TuSimple/LSTR/db/tusimple.py", line 137, in _load_data self.max_points) = torch.load(f) ValueError: too many values to unpack (expected 5)

I am beginner, expect your help. Thanks!!!!

liuruijin17 commented 3 years ago

Hi,

1) Pls don't copy cache/nnet/LSTR/LSTR500000.pkl to cache/tusimple['test_label'].pkl

2) the cache/nnet/LSTR/LSTR_500000.pkl stores the trained model parameters

3) the cache/tusimple_['test_label'].pkl stores (image_path, labels) information. It will be generated automatically when you run the test script if you put the files directories same as:

TuSimple/
    LaneDetection/
        clips/
        label_data_0313.json
        label_data_0531.json
        label_data_0601.json
        test_label.json
    LSTR/

Feel free to ask me if you encounter other questions

happyLifeAndWorking commented 3 years ago

Thanks a lot for your kindly reply. I understand now and run it successfully. Another question is how to make my own data set and train it based on cache/nnet/LSTR/LSTR_500000.pkl? Thank you very much!

liuruijin17 commented 3 years ago

Suppose your dataset has an image and corresponding label file /path/to/images/lane0001.jpg /path/to/annotations/lane0001.json (txt or other formats are also ok, you need to load them by yourself)

After loading .../lane00001.json to become a python object, like a dictionary { 1thLane: [(0., 1.), (2., 3.), (4., 5.)], 2thLane: [(6., 7.), (8., 9.), (10., 11.)], 3thLane: [(12., 13.), (14., 15.), (16., 17.)] }

Then you need to modify the TUSIMPLE._extract_data(self) in db.tusimple.py. The ultimate objective is to feed the self._old_annotations by:

'path': /path/to/images/lane0001.jpg, 'org_path': lane0001.jpg, 'org_lanes': [[0., 2., 4.], [6., 8., 10.], [12., 14., 16.]], 'lanes': [[(0., 1.), (2., 3.), (4., 5.)], [(6., 7.), (8., 9.), (10., 11.)], [(12., 13.), (14., 15.), (16., 17.)]], 'aug': False, 'y_samples':[[1., 3., 5.], [7., 9., 11.], [13., 15., 17.]]

Other codes might be held.

See if there are any other problems I can help you with.

happyLifeAndWorking commented 3 years ago

Thank you very much! I will try as your suggestion!