Water meters - #1
Conversation
… in examples and add empty string in .gitattributes
| @action | ||
| @inbatch_parallel(init='indices', src='images', post='assemble') | ||
| def normalize_images(self, ind, src='images'): | ||
| """ Normalize pixel values from (0, 255) to (0, 1). |
| from ..dataset.dataset import ImagesBatch, action, inbatch_parallel, any_action_failed | ||
|
|
||
| class MeterBatch(ImagesBatch): | ||
| """Class to create batch with water meter""" |
There was a problem hiding this comment.
Кажется, лучше написать Water meters' batch class
There was a problem hiding this comment.
Причем в ридми указывалось, что класс подойдет для любых счетчиков
| dataset index | ||
|
|
||
| src : str | ||
| the name of the placeholder with data |
| Parameters | ||
| ---------- | ||
| ind : str or int | ||
| dataset index |
| Returns | ||
| ------- | ||
| array with indices from batch""" | ||
| _ = args, kwargs |
There was a problem hiding this comment.
kwargs тут лишние, так как используются дальше. args нигде не использутся (и от класса никто не наследуется), нужны ли они вообще?
There was a problem hiding this comment.
лишние kwargs и args удалил везде
| dataset index | ||
|
|
||
| src : str | ||
| the name of the placeholder with data |
|
|
||
| @action | ||
| @inbatch_parallel(init='_init_component', src='images', dst='bbox', target='threads') | ||
| def crop_to_bbox(self, ind, *args, src='images', dst='bbox', **kwargs): |
There was a problem hiding this comment.
*args лучше поставить непосредственно перед kwargs
|
|
||
| dst : str | ||
| the name of the placeholder in witch the result will be recorded""" | ||
| _ = args, kwargs |
There was a problem hiding this comment.
А нужны ли в этой функции args и kwargs?
| _ = args, kwargs | ||
| image = self.get(ind, src) | ||
| coord_str = self.get(ind, 'coordinates') | ||
| x, y, width, height = [int(val) for val in coord_str.split()] |
There was a problem hiding this comment.
x, y, width, height = map(int, coord_str.split())
| return normalize_image | ||
|
|
||
| def _init_component(self, *args, **kwargs): | ||
| """Create and preallocate a new attribute with the name ``dst`` if it |
There was a problem hiding this comment.
Create a new attribute with the name specified by kwargs['dst'] and preallocate memory for it
|
|
||
| def _init_component(self, *args, **kwargs): | ||
| """Create and preallocate a new attribute with the name ``dst`` if it | ||
| does not exist and return batch indices |
There was a problem hiding this comment.
исправил ошибки в английском везде
| @action | ||
| @inbatch_parallel(init='_init_component', src='images', dst='bbox', target='threads') | ||
| def crop_to_bbox(self, ind, *args, src='images', dst='bbox', **kwargs): | ||
| """Create cropped attr with crop image use ``coordinates`` |
There was a problem hiding this comment.
Crop area from image using coordinates attribute
| Parameters | ||
| ---------- | ||
| ind : str or int | ||
| dataset index |
| _ = args, kwargs | ||
| i = self.get_pos(None, src, ind) | ||
| label = getattr(self, src)[i] | ||
| more_label = np.array([int(i) for i in label.replace(',', '')] + [None])[:-1] |
There was a problem hiding this comment.
я бы пояснил, зачем нужен None и [:-1]
| src : str | ||
| data placeholder's name | ||
| dst : str | ||
| the name of the placeholder's in witch the result will be recorded |
There was a problem hiding this comment.
which, а вообще, по-моему, in which можно заменить на where
of the placeholder's - притяжательный падеж ни к чему, если перед этим использован предлог of
а вообще, не очень понятно, что за placeholder?
There was a problem hiding this comment.
заменил на components, так правильнее
GregoryIvanov
left a comment
There was a problem hiding this comment.
Check your English.
Check docstrings.
Don't use 'we' in instructions
|
|
||
| # About Meters | ||
|
|
||
| Meters has two module: [``batch``](https://github.com/analysiscenter/meters/tree/master/meters/batch) and [``pipelines``](https://github.com/analysiscenter/meters/tree/master/meters/pipelines) |
|
|
||
| * ``images``, input images | ||
| * ``labels``, targets for images - array of strings with numbers | ||
| * ``coordinates``, array with four numbers - coordinates of one of the top left corner of the bbox, height and width |
There was a problem hiding this comment.
-- coordinates of the top-left corner, height and width of the bounding box
| * ``images``, input images | ||
| * ``labels``, targets for images - array of strings with numbers | ||
| * ``coordinates``, array with four numbers - coordinates of one of the top left corner of the bbox, height and width | ||
| * ``display``, array with images cropped by ``coordinates`` |
There was a problem hiding this comment.
coordinates don't crop anything.
Array with cropped meters' values or smth like that
| * ``display``, array with images cropped by ``coordinates`` | ||
| * ``digits``, array with ``num_split`` numbers from the meter. | ||
|
|
||
| Actions of MeterBatch allows to e.g.: |
| Actions of MeterBatch allows to e.g.: | ||
|
|
||
| * load images from blosc formats and labels from csv format | ||
| * crop images by coordinates |
There was a problem hiding this comment.
I would write like this : "crop bounding box's area from an image"
| * save prediction to variable named ``prediction``. | ||
|
|
||
| Parameters | ||
| ---------- |
| import numpy as np | ||
|
|
||
| def main(): | ||
| """Convert labels and coordinates from csv to normal format. Normal is ambiguous format""" |
| raise ValueError("Missing required argument '-s'") | ||
|
|
||
| def format_labels(src): | ||
| """Convert labels from csv to normat format""" |
| return labels | ||
|
|
||
| def format_coordinates(src_coord, labels): | ||
| """Convert coordinates from csv to normat format""" |
| return data | ||
|
|
||
| def format_data(src_data): | ||
| """Convert data from csv to normat format""" |
| __version__ = '0.1.0' | ||
|
|
||
|
|
||
| if sys.version_info < (3, 5): |
There was a problem hiding this comment.
This is not needed, as dataset will raise an exception even earlier
| """Batch class for water meter task""" | ||
| import numpy as np | ||
|
|
||
| from ..dataset.dataset import ImagesBatch, action, inbatch_parallel, any_action_failed, DatasetIndex |
There was a problem hiding this comment.
No, pylint can not find imported modules, like ImagesBatch and etc.
| ---------- | ||
| results : array | ||
| loaded data | ||
| Returns |
There was a problem hiding this comment.
done, i corrected all comments.
…removed from meters/__init__
No description provided.