Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Robodummy #57

Draft
wants to merge 45 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
5b8c573
robo user first commit
Pranjal-sopho Jun 11, 2019
04e3fd9
Merge pull request #1 from ilastik/master
Pranjal-sopho Jun 11, 2019
73e4c47
some changes
Pranjal-sopho Jun 11, 2019
2dec996
Merge remote-tracking branch 'origin/master' into robodummy
Pranjal-sopho Jun 11, 2019
3d66cbc
structural changes
Pranjal-sopho Jun 12, 2019
7bf8f81
some structural changes
Pranjal-sopho Jun 13, 2019
d157d9d
deleted unnecessary files
Pranjal-sopho Jun 13, 2019
39fb936
changed tiling to generic+ apply black
Pranjal-sopho Jun 13, 2019
52d0114
switched to n5 for better mem mang.
Pranjal-sopho Jun 17, 2019
83316c2
incorporated suggestions
Pranjal-sopho Jun 18, 2019
8814e98
added test folder
Pranjal-sopho Jun 18, 2019
eb19bb3
indexing now generic and loss configurable
Pranjal-sopho Jun 21, 2019
8220b95
added basic tensorboard logger
Pranjal-sopho Jun 21, 2019
35af962
made changes acc to previous review
Pranjal-sopho Jun 25, 2019
ae97dbd
tiling now completely generic+other modifications
Pranjal-sopho Jun 27, 2019
3b8b7d7
bug fixed in tile_image + other changes
Pranjal-sopho Jul 2, 2019
84d61cb
tests now running
Pranjal-sopho Jul 5, 2019
28640d6
Merge pull request #2 from ilastik/master
Pranjal-sopho Jul 5, 2019
997c4eb
more tensorboard logging
Pranjal-sopho Jul 5, 2019
d355deb
Merge branch 'master' into obodummy
Pranjal-sopho Jul 5, 2019
a9cfecd
tensorboard errors fixed
Pranjal-sopho Jul 8, 2019
fd1eb97
new strategy added
Pranjal-sopho Jul 10, 2019
cba7191
sparse annotation strategies added
Pranjal-sopho Jul 11, 2019
f265faf
video labelling strategies added
Pranjal-sopho Jul 17, 2019
fcce3f2
class annotator added
Pranjal-sopho Jul 19, 2019
4daa134
all bugs fixed
Pranjal-sopho Jul 22, 2019
6be7a82
apply black
Pranjal-sopho Jul 22, 2019
f38692a
Merge pull request #3 from ilastik/master
Pranjal-sopho Jul 22, 2019
27c4f43
new commit
Pranjal-sopho Jul 22, 2019
d1a1cdc
added gitignore
Pranjal-sopho Jul 22, 2019
064c27c
Merge branch 'master' into robodummy
Pranjal-sopho Jul 22, 2019
4c6d9cb
testing..
Pranjal-sopho Jul 23, 2019
3940c55
Update environemnt file to include MrRobot deps
m-novikov Jul 23, 2019
5da186d
Add __init__ and __main__
m-novikov Jul 23, 2019
f45d619
Make __main__ work
m-novikov Jul 23, 2019
3db31e9
Fix confusion_matrix nans
m-novikov Jul 23, 2019
79a77da
Fixes to strategies
m-novikov Jul 23, 2019
6bd9d7e
Fix unstopabble predictions of inferno trainer
m-novikov Jul 23, 2019
055d08f
Add train_for method to tiktorch server
m-novikov Jul 23, 2019
3eec9c8
Use train_for in mr_robot
m-novikov Jul 23, 2019
8e907e3
training problems fixed (temporarily)
Pranjal-sopho Jul 24, 2019
c6ddc1d
training problems fixed (temporarily)
Pranjal-sopho Jul 24, 2019
617a4df
training problems fixed (temporarily)
Pranjal-sopho Jul 25, 2019
39a674d
updating with code used for result prep
Pranjal-sopho Oct 2, 2019
9050f93
strategy params passed generalized and hardcodings for done for resul…
Pranjal-sopho Nov 11, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,5 @@ tiktorch/.idea
tiktorch/__pycache/
/#wrapper.py#
/.#wrapper.py#
.py~
.py~
*.hdf
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there is no need to ignore .nn and .hdf files (as there are none in the repo). Pls remove

3 changes: 3 additions & 0 deletions environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ dependencies:
- inferno=v0.4.*
- pyzmq=18.0.1
- pyyaml=3.13
- seaborn
- z5py
- scikit-learn
- pytest=4.3.0
- black
- isort
Expand Down
Empty file added mr_robot/__init__.py
Empty file.
23 changes: 23 additions & 0 deletions mr_robot/__main__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import argparse

from mr_robot.mr_robot import MrRobot, strategies


parser = argparse.ArgumentParser()
parser.add_argument("-c", "--config", help="Path to config file", type=str, required=True)
parser.add_argument(
"-s", "--strategy", help="Annotation strategy to use", type=str, choices=strategies.keys(), required=True
)
parser.add_argument("-d", "--device", help="Which device to use", type=str, required=True, default="cpu")


def main():
args = parser.parse_args()
robo = MrRobot(args.config, args.strategy, args.device)
robo._load_model()
robo._run()
return 0


if __name__ == "__main__":
exit(main())
54 changes: 54 additions & 0 deletions mr_robot/annotator/annotate.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
import numpy as np
import random

from mr_robot.utils import get_coordinate


class Annotater:
""" The annotater class prvides methods for different labelling strategies, emulating a user
in some way

Args:
annotation_percent (int): percentage of pixels in the patch to annotate
"""

def __init__(self, annotation_percent):
self.annotation_percent = annotation_percent
# self.block_shape = block_shape

def get_random_index(self, block_shape):
random_index = []
for i in range(len(block_shape)):
random_index.append(np.random.randint(0, block_shape[i]))

return tuple(random_index)

def get_random_patch(self, block_shape):
rand_index = self.get_random_index(block_shape)
patch_dimension = []
for i in range(len(block_shape)):
patch_dimension.append(np.random.randint(0, block_shape[i] - rand_index[i]))

block = []
for i in range(len(patch_dimension)):
block.append(slice(rand_index[i], rand_index[i] + patch_dimension[i]))
return tuple(block)

def dense(self, label):
return label

def random_sparse(self, label):
ret_label = np.zeros(label.shape)
for i in range(int(self.annotation_percent) * np.product(label.shape)):
index = self.get_random_index(label.shape)
ret_label[index] = label[index]
return ret_label

def random_blob(self, label):
ret_label = np.ones(label.shape)
for i in range(int(self.annotation_percent) * np.product(label.shape)):
random_block = self.get_random_patch(label.shape)
ret_label[random_block] = label[random_block]
i += np.product(label[random_block].shape)
print("random blob annotated label:", np.unique(ret_label), "labels of actual return patch:", np.unique(label))
return ret_label
Loading