taoxugit / AttnGAN

MIT License
1.34k stars 422 forks source link

FileNotFoundError: File b'../data/coco\\CUB_200_2011/bounding_boxes.txt' does not exist #25

Open AnwarUllahKhan opened 6 years ago

AnwarUllahKhan commented 6 years ago

(base) H:\AttnGAN-master\code>python pretrain_DAMSM.py --cfg cfg/DAMSM/coco.yml --gpu 0 Using config: {'B_VALIDATION': False, 'CONFIG_NAME': 'DAMSM', 'CUDA': True, 'DATASET_NAME': 'coco', 'DATA_DIR': '../data/coco', 'GAN': {'B_ATTENTION': True, 'B_DCGAN': False, 'CONDITION_DIM': 100, 'DF_DIM': 64, 'GF_DIM': 128, 'R_NUM': 2, 'Z_DIM': 100}, 'GPU_ID': 0, 'RNN_TYPE': 'LSTM', 'TEXT': {'CAPTIONS_PER_IMAGE': 5, 'EMBEDDING_DIM': 256, 'WORDS_NUM': 15}, 'TRAIN': {'BATCH_SIZE': 48, 'B_NET_D': True, 'DISCRIMINATOR_LR': 0.0002, 'ENCODER_LR': 0.002, 'FLAG': True, 'GENERATOR_LR': 0.0002, 'MAX_EPOCH': 600, 'NET_E': '', 'NET_G': '', 'RNN_GRAD_CLIP': 0.25, 'SMOOTH': {'GAMMA1': 4.0, 'GAMMA2': 5.0, 'GAMMA3': 10.0, 'LAMBDA': 1.0}, 'SNAPSHOT_INTERVAL': 5}, 'TREE': {'BASE_SIZE': 299, 'BRANCH_NUM': 1}, 'WORKERS': 1} C:\ProgramData\Anaconda3\lib\site-packages\torchvision\transforms\transforms.py:188: UserWarning: The use of the transforms.Scale transform is deprecated, please use transforms.Resize instead. "please use transforms.Resize instead.") Traceback (most recent call last): File "pretrain_DAMSM.py", line 243, in transform=image_transform) File "H:\AttnGAN-master\code\datasets.py", line 110, in init self.bbox = self.load_bbox() File "H:\AttnGAN-master\code\datasets.py", line 126, in load_bbox header=None).astype(int) File "C:\ProgramData\Anaconda3\lib\site-packages\pandas\io\parsers.py", line 678, in parser_f return _read(filepath_or_buffer, kwds) File "C:\ProgramData\Anaconda3\lib\site-packages\pandas\io\parsers.py", line 440, in _read parser = TextFileReader(filepath_or_buffer, kwds) File "C:\ProgramData\Anaconda3\lib\site-packages\pandas\io\parsers.py", line 787, in init self._make_engine(self.engine) File "C:\ProgramData\Anaconda3\lib\site-packages\pandas\io\parsers.py", line 1014, in _make_engine self._engine = CParserWrapper(self.f, self.options) File "C:\ProgramData\Anaconda3\lib\site-packages\pandas\io\parsers.py", line 1708, in init self._reader = parsers.TextReader(src, **kwds) File "pandas_libs\parsers.pyx", line 384, in pandas._libs.parsers.TextReader.cinit File "pandas_libs\parsers.pyx", line 695, in pandas._libs.parsers.TextReader._setup_parser_source FileNotFoundError: File b'../data/coco\CUB_200_2011/bounding_boxes.txt' does not exist

AnwarUllahKhan commented 6 years ago

Dear researchers, I am facing this problem using coco dataset so how can I found bounding_boxes.txt file for coco dataset? @sethjuarez @taoxugit

Thank you very much

RaiAbhishek commented 6 years ago

coco dataset does not need bounding boxes. proceed with: self.bbox = None

AnwarUllahKhan commented 6 years ago

@RaiAbhishek dear, this is the code if data_dir.find('birds') != -1: self.bbox = self.load_bbox() else: self.bbox = None split_dir = os.path.join(data_dir, split)

    self.filenames, self.captions, self.ixtoword, \
        self.wordtoix, self.n_words = self.load_text_data(data_dir, split)

    self.class_id = self.load_class_id(split_dir, len(self.filenames))
    self.number_example = len(self.filenames)

def load_bbox(self):
    data_dir = self.data_dir
    bbox_path = os.path.join(data_dir, 'CUB_200_2011/bounding_boxes.txt')
    df_bounding_boxes = pd.read_csv(bbox_path,
                                    delim_whitespace=True,
                                    header=None).astype(int)

Actually when I did this self.bbox = None then I am facing another a lot of problems, I think this is my data path problem let me explain where can I exactly put my images data, caption data and other files, I shall be very thankful to you and one more question that is pickle file that will be generated automatically or I need to make it?

AnwarUllahKhan commented 6 years ago

@RaiAbhishek @sethjuarez @taoxugit

Load from: ../data/coco\captions.pickle 1 5 Traceback (most recent call last): File "pretrain_DAMSM.py", line 246, in assert dataset AssertionError

how can I solve this problem?

growingfuture commented 5 years ago

I solved it like below

go into the code > cfg > DAMSM find the bird.yml and coco.yml and change below
DATA_DIR:` '../data/birds' # write down your own path instead of ../

Hope to be helpful!