(index_path, classes_num, filename)
| 218 | |
| 219 | |
| 220 | def process_ipc(index_path, classes_num, filename): |
| 221 | # load data |
| 222 | logging.info("Load Data...............") |
| 223 | ipc = [[] for _ in range(classes_num)] |
| 224 | with h5py.File(index_path, "r") as f: |
| 225 | for i in tqdm(range(len(f["target"]))): |
| 226 | t_class = np.where(f["target"][i])[0] |
| 227 | for t in t_class: |
| 228 | ipc[t].append(i) |
| 229 | print(ipc) |
| 230 | np.save(filename, ipc) |
| 231 | logging.info("Load Data Succeed...............") |
| 232 | |
| 233 | |
| 234 | def save_to_dict(s, o_={}): |