{"nwo":"ClementPinard\/DepthNet","sha":"3c753fc21b06c9be307d73c8e7a0c61f2ea56cc3","path":"terminal_logger.py","language":"python","identifier":"Writer.__init__","parameters":"(self, t, location)","argument_list":"","return_statement":"","docstring":"Input: location - tuple of ints (x, y), the position\n of the bar in the terminal","docstring_summary":"Input: location - tuple of ints (x, y), the position\n of the bar in the terminal","docstring_tokens":["Input",":","location","-","tuple","of","ints","(","x","y",")","the","position","of","the","bar","in","the","terminal"],"function":"def __init__(self, t, location):\n \"\"\"\n Input: location - tuple of ints (x, y), the position\n of the bar in the terminal\n \"\"\"\n self.location = location\n self.t = t","function_tokens":["def","__init__","(","self",",","t",",","location",")",":","self",".","location","=","location","self",".","t","=","t"],"url":"https:\/\/github.com\/ClementPinard\/DepthNet\/blob\/3c753fc21b06c9be307d73c8e7a0c61f2ea56cc3\/terminal_logger.py#L45-L51"} {"nwo":"ClementPinard\/DepthNet","sha":"3c753fc21b06c9be307d73c8e7a0c61f2ea56cc3","path":"datasets\/stillbox.py","language":"python","identifier":"make_dataset","parameters":"(root_dir, split=0, shift=3, seed=None)","argument_list":"","return_statement":"return (train_scenes, test_images)","docstring":"Will search for subfolder and will read metadata json files.","docstring_summary":"Will search for subfolder and will read metadata json files.","docstring_tokens":["Will","search","for","subfolder","and","will","read","metadata","json","files","."],"function":"def make_dataset(root_dir, split=0, shift=3, seed=None):\n \"\"\"Will search for subfolder and will read metadata json files.\"\"\"\n global args\n random.seed(seed)\n scenes = []\n for sub_dir in root_dir.dirs():\n metadata_path = sub_dir\/'metadata.json'\n with open(metadata_path, 'r') as f:\n metadata = json.load(f)\n for scene in metadata['scenes']:\n scene['subdir'] = sub_dir.basename()\n scenes.extend(metadata['scenes'])\n\n assert(len(scenes) > 0)\n random.shuffle(scenes)\n split_index = math.floor(len(scenes)*split\/100)\n assert(split_index >= 0 and split_index <= len(scenes))\n train_scenes = scenes[:split_index]\n test_images = []\n if split_index < len(scenes):\n for scene in scenes[split_index+1:]:\n imgs = scene['imgs']\n for i in range(len(imgs)-shift):\n img_pair = [str(scene['subdir']\/imgs[i]), str(scene['subdir']\/imgs[i+shift])]\n depth = str(scene['subdir']\/scene['depth'][i + shift])\n displacement = np.array(scene['speed']).astype(np.float32)*shift*scene['time_step']\n test_images.append(\n [img_pair,\n depth,\n displacement]\n )\n return (train_scenes, test_images)","function_tokens":["def","make_dataset","(","root_dir",",","split","=","0",",","shift","=","3",",","seed","=","None",")",":","global","args","random",".","seed","(","seed",")","scenes","=","[","]","for","sub_dir","in","root_dir",".","dirs","(",")",":","metadata_path","=","sub_dir","\/","'metadata.json'","with","open","(","metadata_path",",","'r'",")","as","f",":","metadata","=","json",".","load","(","f",")","for","scene","in","metadata","[","'scenes'","]",":","scene","[","'subdir'","]","=","sub_dir",".","basename","(",")","scenes",".","extend","(","metadata","[","'scenes'","]",")","assert","(","len","(","scenes",")",">","0",")","random",".","shuffle","(","scenes",")","split_index","=","math",".","floor","(","len","(","scenes",")","*","split","\/","100",")","assert","(","split_index",">=","0","and","split_index","<=","len","(","scenes",")",")","train_scenes","=","scenes","[",":","split_index","]","test_images","=","[","]","if","split_index","<","len","(","scenes",")",":","for","scene","in","scenes","[","split_index","+","1",":","]",":","imgs","=","scene","[","'imgs'","]","for","i","in","range","(","len","(","imgs",")","-","shift",")",":","img_pair","=","[","str","(","scene","[","'subdir'","]","\/","imgs","[","i","]",")",",","str","(","scene","[","'subdir'","]","\/","imgs","[","i","+","shift","]",")","]","depth","=","str","(","scene","[","'subdir'","]","\/","scene","[","'depth'","]","[","i","+","shift","]",")","displacement","=","np",".","array","(","scene","[","'speed'","]",")",".","astype","(","np",".","float32",")","*","shift","*","scene","[","'time_step'","]","test_images",".","append","(","[","img_pair",",","depth",",","displacement","]",")","return","(","train_scenes",",","test_images",")"],"url":"https:\/\/github.com\/ClementPinard\/DepthNet\/blob\/3c753fc21b06c9be307d73c8e7a0c61f2ea56cc3\/datasets\/stillbox.py#L10-L41"}