{"action":"closed","issue":{"url":"https://api.github.com/repos/roytseng-tw/Detectron.pytorch/issues/16","repository_url":"https://api.github.com/repos/roytseng-tw/Detectron.pytorch","labels_url":"https://api.github.com/repos/roytseng-tw/Detectron.pytorch/issues/16/labels{/name}","comments_url":"https://api.github.com/repos/roytseng-tw/Detectron.pytorch/issues/16/comments","events_url":"https://api.github.com/repos/roytseng-tw/Detectron.pytorch/issues/16/events","html_url":"https://github.com/roytseng-tw/Detectron.pytorch/issues/16","id":316318596,"number":16,"title":"Unable to Properly Load Classes","user":{"login":"jameschartouni","id":16104649,"avatar_url":"https://avatars1.githubusercontent.com/u/16104649?v=4","gravatar_id":"","url":"https://api.github.com/users/jameschartouni","html_url":"https://github.com/jameschartouni","followers_url":"https://api.github.com/users/jameschartouni/followers","following_url":"https://api.github.com/users/jameschartouni/following{/other_user}","gists_url":"https://api.github.com/users/jameschartouni/gists{/gist_id}","starred_url":"https://api.github.com/users/jameschartouni/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jameschartouni/subscriptions","organizations_url":"https://api.github.com/users/jameschartouni/orgs","repos_url":"https://api.github.com/users/jameschartouni/repos","events_url":"https://api.github.com/users/jameschartouni/events{/privacy}","received_events_url":"https://api.github.com/users/jameschartouni/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":5,"created_at":"2018-04-20T15:45:15Z","updated_at":"2018-05-02T23:59:35Z","closed_at":"2018-05-02T23:59:35Z","author_association":"NONE","body":"I am trying to train a model using a custom JSON dataset that I converted to the COCO format. I've adapted the code given in train.py, but I am unable to load the classes properly. Regardless of what number of classes I specify in the config file, I am getting this same error. Is there an obvious mistake that I am making? Thank you!\r\n\r\n```\r\ntimers = defaultdict(Timer)\r\n\r\n### Dataset ###\r\ntimers['roidb'].tic()\r\nroidb, ratio_list, ratio_index = combined_roidb_for_training(cfg.TRAIN.DATASETS, cfg.TRAIN.PROPOSAL_FILES)\r\ntimers['roidb'].toc()\r\ntrain_size = len(roidb)\r\nlogger.info('{:d} roidb entries'.format(train_size))\r\nlogger.info('Takes %.2f sec(s) to construct roidb', timers['roidb'].average_time)\r\n\r\nsampler = MinibatchSampler(ratio_list, ratio_index)\r\ndataset = RoiDataLoader(\r\n    roidb,\r\n    cfg.MODEL.NUM_CLASSES,\r\n    training=True)\r\ndataloader = torch.utils.data.DataLoader(\r\n    dataset,\r\n    batch_size=args.batch_size,\r\n    sampler=sampler,\r\n    num_workers=cfg.DATA_LOADER.NUM_THREADS,\r\n    collate_fn=collate_minibatch)\r\n\r\nassert_and_infer_cfg()\r\n\r\n```\r\nThe output:\r\n\r\n```\r\nINFO:datasets.json_dataset:Loading cached gt_roidb from /home/cees2/Image Project/Code/mask-rcnn.pytorch/data/cache/init_data_gt_roidb.pkl\r\nINFO:datasets.roidb:Appending horizontally-flipped training examples...\r\nINFO:datasets.roidb:Loaded dataset: init_data\r\nINFO:datasets.roidb:Filtered 120 roidb entries: 120 -> 0\r\nINFO:datasets.roidb:Computing image aspect ratios and ordering the ratios...\r\nINFO:datasets.roidb:done\r\nINFO:datasets.roidb:Computing bounding-box regression targets...\r\nINFO:datasets.roidb:done\r\nloading annotations into memory...\r\nDone (t=0.01s)\r\ncreating index...\r\nindex created!\r\n[]\r\n---------------------------------------------------------------------------\r\nIndexError                                Traceback (most recent call last)\r\n<ipython-input-4-f5a66a92f826> in <module>()\r\n      3 ### Dataset ###\r\n      4 timers['roidb'].tic()\r\n----> 5 roidb, ratio_list, ratio_index = combined_roidb_for_training(cfg.TRAIN.DATASETS, cfg.TRAIN.PROPOSAL_FILES)\r\n      6 timers['roidb'].toc()\r\n      7 train_size = len(roidb)\r\n\r\n~/Image Project/Code/mask-rcnn.pytorch/lib/datasets/roidb.py in combined_roidb_for_training(dataset_names, proposal_files)\r\n     77     logger.info('done')\r\n     78 \r\n---> 79     _compute_and_log_stats(roidb)\r\n     80 \r\n     81     return roidb, ratio_list, ratio_index\r\n\r\n~/Image Project/Code/mask-rcnn.pytorch/lib/datasets/roidb.py in _compute_and_log_stats(roidb)\r\n    229 def _compute_and_log_stats(roidb):\r\n    230     print(roidb)\r\n--> 231     classes = roidb[0]['dataset'].classes\r\n    232     char_len = np.max([len(c) for c in classes])\r\n    233     hist_bins = np.arange(len(classes) + 1)\r\n\r\nIndexError: list index out of range\r\n```\r\n\r\n"}}
{"actor":{"display_login":"roytseng-tw"}}