-
Notifications
You must be signed in to change notification settings - Fork 0
Water meters #1
base: master
Are you sure you want to change the base?
Water meters #1
Conversation
… in examples and add empty string in .gitattributes
meters/batch/meter_batch.py
Outdated
@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). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pixels' values
meters/batch/meter_batch.py
Outdated
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Кажется, лучше написать Water meters' batch class
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Причем в ридми указывалось, что класс подойдет для любых счетчиков
meters/batch/meter_batch.py
Outdated
dataset index | ||
|
||
src : str | ||
the name of the placeholder with data |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
data placeholder's name
meters/batch/meter_batch.py
Outdated
Parameters | ||
---------- | ||
ind : str or int | ||
dataset index |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
dataset's index
meters/batch/meter_batch.py
Outdated
Returns | ||
------- | ||
array with indices from batch""" | ||
_ = args, kwargs |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
kwargs тут лишние, так как используются дальше. args нигде не использутся (и от класса никто не наследуется), нужны ли они вообще?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
лишние kwargs и args удалил везде
meters/batch/meter_batch.py
Outdated
dataset index | ||
|
||
src : str | ||
the name of the placeholder with data |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
data placeholder's name
meters/batch/meter_batch.py
Outdated
|
||
@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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
*args лучше поставить непосредственно перед kwargs
meters/batch/meter_batch.py
Outdated
|
||
dst : str | ||
the name of the placeholder in witch the result will be recorded""" | ||
_ = args, kwargs |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
А нужны ли в этой функции args и kwargs?
meters/batch/meter_batch.py
Outdated
_ = 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
x, y, width, height = map(int, coord_str.split())
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
исправил
meters/batch/meter_batch.py
Outdated
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Create a new attribute with the name specified by kwargs['dst']
and preallocate memory for it
meters/batch/meter_batch.py
Outdated
|
||
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
batch's indices
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
исправил ошибки в английском везде
meters/batch/meter_batch.py
Outdated
@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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Crop area from image using coordinates
attribute
meters/batch/meter_batch.py
Outdated
Parameters | ||
---------- | ||
ind : str or int | ||
dataset index |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
dataset's index
meters/batch/meter_batch.py
Outdated
_ = 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
я бы пояснил, зачем нужен None и [:-1]
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
добавил коммент
meters/batch/meter_batch.py
Outdated
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
which, а вообще, по-моему, in which можно заменить на where
of the placeholder's - притяжательный падеж ни к чему, если перед этим использован предлог of
а вообще, не очень понятно, что за placeholder?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
заменил на components, так правильнее
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Check your English.
Check docstrings.
Don't use 'we' in instructions
README.md
Outdated
# 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) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
two modules
docs/intro/batch.rst
Outdated
|
||
* ``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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
-- coordinates of the top-left corner, height and width of the bounding box
docs/intro/batch.rst
Outdated
* ``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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
coordinates
don't crop anything.
Array with cropped meters' values or smth like that
docs/intro/batch.rst
Outdated
* ``display``, array with images cropped by ``coordinates`` | ||
* ``digits``, array with ``num_split`` numbers from the meter. | ||
|
||
Actions of MeterBatch allows to e.g.: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
allows to:
docs/intro/batch.rst
Outdated
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would write like this : "crop bounding box's area from an image"
meters/pipelines/pipelines.py
Outdated
* save prediction to variable named ``prediction``. | ||
|
||
Parameters | ||
---------- |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same story as for simple_train
meters/utils/format_data.py
Outdated
import numpy as np | ||
|
||
def main(): | ||
"""Convert labels and coordinates from csv to normal format. Normal is ambiguous format""" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very confusing comment
meters/utils/format_data.py
Outdated
raise ValueError("Missing required argument '-s'") | ||
|
||
def format_labels(src): | ||
"""Convert labels from csv to normat format""" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the same story
meters/utils/format_data.py
Outdated
return labels | ||
|
||
def format_coordinates(src_coord, labels): | ||
"""Convert coordinates from csv to normat format""" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
confusing
meters/utils/format_data.py
Outdated
return data | ||
|
||
def format_data(src_data): | ||
"""Convert data from csv to normat format""" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
confusing
meters/__init__.py
Outdated
__version__ = '0.1.0' | ||
|
||
|
||
if sys.version_info < (3, 5): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not needed, as dataset
will raise an exception even earlier
meters/batch/meter_batch.py
Outdated
"""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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
one dataset
is not enough?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, pylint can not find imported modules, like ImagesBatch and etc.
meters/batch/meter_batch.py
Outdated
---------- | ||
results : array | ||
loaded data | ||
Returns |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add blank line before
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done, i corrected all comments.
…removed from meters/__init__
No description provided.