-
Notifications
You must be signed in to change notification settings - Fork 1
Landmark Detection RL
Created a new venv for trying out the previous version of tensorpack(0.8.0)https://github.com/amiralansary/tensorpack-medical/issues/9#issuecomment-493283146. Download tensorpack 0.8.0 from https://github.com/tensorpack/tensorpack/releases/tag/0.8.0. Change setup.cfg to this https://github.com/tensorpack/tensorpack/blob/2aefaf781d31a374bcdeafbc36f2e284a38f2286/setup.cfg. install tensorpack using python3 setup.py install. Install the rest of the things as done above. Run python3 DQN.py --task eval --algo DQN --gpu 0 --load data/models/DQN_multiscale_brain_mri_point_pc_ROI_45_45_45/model-600000 --files './data/filenames/image_files.txt' './data/filenames/landmark_files.txt'.
Traceback (most recent call last): File "DQN.py", line 235, in output_names=['Qvalue'])) File "/home/arjjain/Prev Version/prev/lib/python3.6/site-packages/tensorpack-0.8.0-py3.6.egg/tensorpack/predict/base.py", line 163, in init config.tower_func(*input.get_input_tensors()) File "/home/arjjain/Prev Version/prev/lib/python3.6/site-packages/tensorpack-0.8.0-py3.6.egg/tensorpack/tfutils/tower.py", line 199, in call output = self._tower_fn(*args) File "/home/arjjain/Prev Version/prev/lib/python3.6/site-packages/tensorpack-0.8.0-py3.6.egg/tensorpack/graph_builder/model_desc.py", line 122, in build_graph self._build_graph(inputs) File "/home/arjjain/Downloads/tensorpack-0.8.0/tensorpack-medical/examples/LandmarkDetection/DQN/DQNModel.py", line 151, in _build_graph self.predict_value = self.get_DQN_prediction(state) File "/home/arjjain/Prev Version/prev/lib/python3.6/site-packages/tensorpack-0.8.0-py3.6.egg/tensorpack/tfutils/scope_utils.py", line 46, in wrapper return func(*args, **kwargs) File "/home/arjjain/Downloads/tensorpack-0.8.0/tensorpack-medical/examples/LandmarkDetection/DQN/DQNModel.py", line 145, in get_DQN_prediction return self._get_DQN_prediction(image) File "DQN.py", line 88, in _get_DQN_prediction with argscope(Conv3D, nl=PReLU.symbolic_function, use_bias=True): File "/usr/lib/python3.6/contextlib.py", line 81, in enter return next(self.gen) File "/home/arjjain/Prev Version/prev/lib/python3.6/site-packages/tensorpack-0.8.0-py3.6.egg/tensorpack/tfutils/argscope.py", line 45, in argscope _check_args_exist(l.symbolic_function) File "/home/arjjain/Prev Version/prev/lib/python3.6/site-packages/tensorpack-0.8.0-py3.6.egg/tensorpack/tfutils/argscope.py", line 41, in _check_args_exist assert k in args, "No argument {} in {}".format(k, l.name) AssertionError: No argument nl in Conv3D
Go to YOUR_ENV/lib/python3.6/site-packages/tensorpack_medical/models/conv3d.py and comment out the first definition of Conv3D and uncomment the second definition. Working Fine
Create a new venv for testing multiagent. Go to data/filenames, and for both the files, just keep the first line (Only 1 example) Change files_list[X] to files_list[X].name in filesListBrainMRLandmark init (dataReader.py) replace filesListFetalUSLandmark with filesListBrainMRLandmark in medicalplayer init (medical.py) For all the Fully Connected blocks in DQN.py, replace activation with nl Make the steps per epoch to be 1000 for now make it all_landmarks[i] on line 285 dataReader.py These steps make the training work. i.e we could run the command python3 DQN.py --task train --algo DQN --gpu 0 --agents 2 --files './data/filenames/image_files.txt' './data/filenames/landmark_files.txt' Interrupt it after 1 epoch
python3 DQN.py --task train --algo DQN --gpu 0 --agents 2 --files './data/filenames/image_files.txt' './data/filenames/landmark_files.txt' also works fine. Interrupt it.
Modify task = args.task on line 272 DQN.py
replace target_point = self._target_loc[i] by target_point = None if self.task != 'play': target_point = self._target_loc[i] on line 734 medical.py
python3 DQN.py --task play --algo DQN --gpu 0 --agents 2 --load ./train_log/dev/model-1000 --files './data/filenames /image_files.txt' also works
In medical.py
gifname = self.filename[0] + '.gif' on line 810 remove i=1 in line 731 Line 766, 'Agent ' to be replaced with 'Agent ' + str(i)
Till now
Single Agent works fine
Multi Agent works but the inferences show the agents going away from the target. Need to train more to confirm.
Multi agent changes contd
in medical.py, on line 249, make it filepath[0], and, insert the line self._image, self._target_loc, self.filepath, self.spacing = next(self.sampled_files) just below it. add self._images = None on line 174, self._images = [] on line 248, create variable lists, self.spacings, self._target_locs, self._images to store these just like filepath is being stored
Things to do
Try different types of heuristics for the model. Coarse to Fine. 5lmks -> 15 lmks -> ... (initializer and/or params in net) and optimize these too
write scripts for easy installation
SINGLE https://drive.google.com/open?id=1Z7v9WAZnzMWnQytlFd9_NOlQZoXNWSa4
MULTI https://drive.google.com/drive/folders/1Z-CUYFA1foSXfzuvo5Po4v4beMnsD7LS?usp=sharing