Skip to content
This repository has been archived by the owner on Jul 2, 2021. It is now read-only.

Fix the range of offset in random_crop #534

Merged
merged 2 commits into from
Mar 8, 2018

Conversation

akitotakeki
Copy link
Contributor

No description provided.

@akitotakeki akitotakeki changed the title fix the range of offset fix the range of offset in random_crop Mar 8, 2018
@akitotakeki akitotakeki changed the title fix the range of offset in random_crop Fix the range of offset in random_crop Mar 8, 2018
@Hakuyume
Copy link
Member

Hakuyume commented Mar 8, 2018

Thank you for PR. How about using random.randint (https://docs.python.org/3/library/random.html#random.randint)? It returns an integer from [a, b] (both boundaries are included).

And I find that img.shape[1] == H and img.shape[1] > H can be merged.

    if img.shape[1] >= H:
         y_offset = random.randint(0, img.shape[1] - H)
    else:
         raise ValueError(...

@Hakuyume Hakuyume added the bug label Mar 8, 2018
@akitotakeki
Copy link
Contributor Author

@Hakuyume Thanks for the review. I've fixed the points.

Copy link
Member

@Hakuyume Hakuyume left a comment

Choose a reason for hiding this comment

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

LGTM

@Hakuyume Hakuyume merged commit cb3fae2 into chainer:master Mar 8, 2018
@akitotakeki akitotakeki deleted the akitotakeki-fix-offset branch April 15, 2018 06:10
@yuyu2172 yuyu2172 added this to the v0.9 milestone Apr 17, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants