+
Skip to content

Add ScoreTiler #129

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

Merged
merged 15 commits into from
Aug 22, 2020
Merged

Add ScoreTiler #129

merged 15 commits into from
Aug 22, 2020

Conversation

alessiamarcolini
Copy link
Collaborator

A ScoreTiler is basically a GridTiler (because it extracts all the tiles following a grid structure), but it saves only the first n_tiles with the highest score, according to a scoring function. If n_tiles is equal to 0, it saves all the tiles (exact same behavior as a GridTiler)

Scorer

The scoring functions are implemented in the scorer module. All the scorers are classes with a __call__ method, which takes as parameter a Tile object and returns a float. These characteristics are implemented in the Scorer protocol. At the moment there is only a RandomScorer, which returns a random number between 0 and 1, not considering the tile, but it serves as an initial example.

Example

from histolab.scorer import RandomScorer
from histolab.tile import Tile

random_scorer = RandomScorer()
tile = Tile(img, coords, level)
score = random_scorer(tile)

ScoreTiler

The ScoreTiler (other than the parameters required by a GridTiler) needs a scoring function (which implements the Scoring protocol).

Example

# following from the previous example

from histolab.tiler import ScoreTiler
from histolab.slide import Slide

slide = Slide("path/to/slide", "path/to/processed")
score_tiler = ScoreTiler(random_scorer, tile_size=(512,512), n_tiles=2, level=0, ...)
score_tiler.extract(slide)

@alessiamarcolini
Copy link
Collaborator Author

We should save a .csv file containing the filenames of the tiles and the associated scores

Copy link
Member

@ernestoarbitrio ernestoarbitrio left a comment

Choose a reason for hiding this comment

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

GENERAL COMMENT + SOME MINOR COMMENTS -> Please refactor the code respecting alphabetic order for methods and props, furthermore do not mix private and public func/props

Copy link
Member

@ernestoarbitrio ernestoarbitrio left a comment

Choose a reason for hiding this comment

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

LGTM!

@alessiamarcolini alessiamarcolini merged commit 3541606 into master Aug 22, 2020
@alessiamarcolini alessiamarcolini deleted the score-tiler branch August 22, 2020 19:50
@alessiamarcolini
Copy link
Collaborator Author

fixes #83

@alessiamarcolini alessiamarcolini linked an issue Aug 24, 2020 that may be closed by this pull request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Score tiles
3 participants
点击 这是indexloc提供的php浏览器服务,不要输入任何密码和下载