Conversation
mr_robot/mr_robot.py
Outdated
There was a problem hiding this comment.
__init__ should not raise NotImplementedError. In fact, it is a good style to call super().__init__() in your derived class...
There was a problem hiding this comment.
actually, this being work in progress, if you want to indicate that your BaseStrategy is not fully implemented yet, this is fine. (Calling super().__init__() in your derived class would still make sense)
mr_robot/utils.py
Outdated
There was a problem hiding this comment.
it seems to me that image tiling could nicely be implemented for n dimensions. Maybe have a look at https://github.com/ilastik/lazyflow/blob/dfbb450989d4f790f5b19170383b777fb88be0e8/lazyflow/roi.py#L473 for some inspiration
mr_robot/mr_robot.py
Outdated
There was a problem hiding this comment.
we should avoid uncommented import statements (just remove this line)
mr_robot/mr_robot.py
Outdated
There was a problem hiding this comment.
[optional] use a logger, instead of print:
import logging
logger = logging.getLogger(__name__)
...
logger.info("model loaded")
mr_robot/mr_robot.py
Outdated
There was a problem hiding this comment.
instead of taking the first slice [0, ...] and then expanding the resulting array, you should simplify to take a slice right away:
[0:1, ...]
mr_robot/mr_robot.py
Outdated
There was a problem hiding this comment.
As we discussed these paths should be moved to robot config.
mr_robot/mr_robot.py
Outdated
There was a problem hiding this comment.
In general, variable names need some polishing. They should be descriptive and have a clear scope.
|
|
||
| # run prediction | ||
| op = robo.predict() | ||
|
|
There was a problem hiding this comment.
Here I think algorithm should be read as follows:
# Step 1. Intialization
robo = MrRobot('/home/user/config.yaml') # Here robot loads all required data
robo.use_strategy(StrategyRandom())
# or even
robo = MrRobot('/home/user/config.yaml', StrategyRandom)
# Step 2. Start
robo.start() # Start tiktorch server
# Step 3. Prediction loop
while robo.should_stop():
robo.predict()
# def robo.predict
# 1. labels? = self.strategy.get_next_patch(<relevant data>)
# 2. self.update_training(labels, ...)
# Step 4. Termination
robo.terminate()
There was a problem hiding this comment.
yes, I'd vote for
robo = MrRobot('/home/user/config.yaml', StrategyRandom)
mr_robot/mr_robot.py
Outdated
There was a problem hiding this comment.
the following code should be inside of MrRobot. Currently you mirror parts of the tiktorch api in MrRobot (methods: resume, predict, add). This is fine for convenience, etc, but in it's core MrRobot should implement the way of running a 'user simulation'
mr_robot/mr_robot.py
Outdated
There was a problem hiding this comment.
the criterion should be configurable
mr_robot/mr_robot.py
Outdated
There was a problem hiding this comment.
same indexing as in predict method
mr_robot/mr_robot.py
Outdated
There was a problem hiding this comment.
I would prefer the robot class to perform the 'run', not the strategy. The strategy should effectively implement a sampling strategy. I see this analog to the pytorch sampler.
We might even be able to use the pytorch dataset and the pytorch dataloader for our purposes (and then implement our strategy as a 'Sampler'
mr_robot/mr_robot.py
Outdated
There was a problem hiding this comment.
including _robo_ in this variable name seems redundant, considering we are in the MrRobot class
mr_robot/mr_robot.py
Outdated
There was a problem hiding this comment.
counter as a property name is a bit confusing here (it is not obvious what's being counted)
I would suggest
self.iterations_maxself.iterations_done
if that is what you intend
mr_robot/mr_robot.py
Outdated
There was a problem hiding this comment.
you should run black on your code (this will convert ' to " where possible)
mr_robot/mr_robot.py
Outdated
There was a problem hiding this comment.
no need to open this file every time add is called. This should be in __init__. use self.file here
mr_robot/mr_robot.py
Outdated
There was a problem hiding this comment.
"cremi_data" should instead be something like "raw_data_path" and "label_data_path" (1. cremi is just an example. 2. raw data and label data are not necessarily in the same file)
mr_robot/mr_robot.py
Outdated
There was a problem hiding this comment.
you should not hardcode that the data is 3 dimensional, use tuples to index instead
mr_robot/mr_robot.py
Outdated
There was a problem hiding this comment.
it would be great if you could add some doc strings to communicate what your methods (and classes) are for
There was a problem hiding this comment.
There was a problem hiding this comment.
also: no need to call this method base_patch. naming it patch and calling super().patch() in a derived class works as well (even when you overwrite patch in the derived class, that's what the super(), resolves for you)
some more 'how-to-inherit' here: https://www.python.org/dev/peps/pep-0008/#designing-for-inheritance
| .py~ No newline at end of file | ||
| .py~ | ||
| *.nn | ||
| *.hdf |
There was a problem hiding this comment.
there is no need to ignore .nn and .hdf files (as there are none in the repo). Pls remove
mr_robot/mr_robot.py
Outdated
There was a problem hiding this comment.
we decided that changing strategy is a strategy of its own...
mr_robot/mr_robot.py
Outdated
There was a problem hiding this comment.
do not hard code 'personal' paths, etc...
suggestion:
get absolute path of mr_robot.py and deduct the absolute path to mr_robot folder:
mr_robot_folder = os.path.dirname(os.path.abspath(__file__))
add log folder to it:
logdir=os.path.join(mr_robot_folder, "logs")
mr_robot/utils.py
Outdated
There was a problem hiding this comment.
delete if this is no longer needed
mr_robot/mr_robot.py
Outdated
There was a problem hiding this comment.
do not hard code use of a specific gpu, use environment variables
reatain fwd pass ids
retain ids from forward pass
…t compilation removed
No description provided.