caffe icon indicating copy to clipboard operation
caffe copied to clipboard

[bug report] Floating point exception when width and/or height equals crop_size

Open mlapin opened this issue 12 years ago • 9 comments

In

src/caffe/data_transformer.cpp

replace

      h_off = Rand() % (height - crop_size);
      w_off = Rand() % (width - crop_size);

with

      h_off = height > crop_size ? Rand() % (height - crop_size) : 0;
      w_off = width > crop_size ? Rand() % (width - crop_size) : 0;

mlapin avatar Oct 01 '14 14:10 mlapin

Can you prepare a PULL REQUEST?

bhack avatar Oct 01 '14 15:10 bhack

Is this the same bug fixed in dev by #1149 but still in master?

shelhamer avatar Oct 01 '14 16:10 shelhamer

I think that this want also to assert that crop_size in not > of width and height.

bhack avatar Oct 01 '14 16:10 bhack

@shelhamer right, this is fixed by #1149. @mlapin, you should be able to use the fix by merging with master or whatever branch you are on. Note that the original code is wrong, and the proposed solution is also wrong.

@shelhamer should we merge the fix also to master? I didn't bother since it seemed like an uncommon thing, but maybe this codepath gets hit more often with the data transformer refactoring...

longjon avatar Oct 01 '14 17:10 longjon

Yeah, we should likely cherry-pick the fix. It'll cause a conflict in the next release merge but oh well.

It's not yet second-nature to merge fixes to master instead, so I've fallen into the same trap with a few recent fixes in dev.

On Wednesday, October 1, 2014, longjon [email protected] wrote:

@shelhamer https://github.com/shelhamer right, this is fixed by #1149 https://github.com/BVLC/caffe/pull/1149. @mlapin https://github.com/mlapin, you should be able to use the fix by merging with master or whatever branch you are on. Note that the original code is wrong, and the proposed solution is also wrong.

@shelhamer https://github.com/shelhamer should we merge this fix also to master? I didn't bother since it seemed like an uncommon thing, but maybe this codepath gets hit more often with the data transformer refactoring...

— Reply to this email directly or view it on GitHub https://github.com/BVLC/caffe/issues/1199#issuecomment-57505156.

shelhamer avatar Oct 01 '14 18:10 shelhamer

If it's a clean merge to master, can we not simply merge to master as well?

On Wed, Oct 1, 2014 at 11:13 AM, Evan Shelhamer [email protected] wrote:

Yeah, we should likely cherry-pick the fix. It'll cause a conflict in the next release merge but oh well.

It's not yet second-nature to merge fixes to master instead, so I've fallen into the same trap with a few recent fixes in dev.

On Wednesday, October 1, 2014, longjon [email protected] wrote:

@shelhamer https://github.com/shelhamer right, this is fixed by #1149 https://github.com/BVLC/caffe/pull/1149. @mlapin https://github.com/mlapin, you should be able to use the fix by merging with master or whatever branch you are on. Note that the original code is wrong, and the proposed solution is also wrong.

@shelhamer https://github.com/shelhamer should we merge this fix also to master? I didn't bother since it seemed like an uncommon thing, but maybe this codepath gets hit more often with the data transformer refactoring...

— Reply to this email directly or view it on GitHub https://github.com/BVLC/caffe/issues/1199#issuecomment-57505156.

— Reply to this email directly or view it on GitHub https://github.com/BVLC/caffe/issues/1199#issuecomment-57510060.

longjon avatar Oct 01 '14 18:10 longjon

The PR was made to dev so you would have to rebase on master or cherry-pick. If you merge the branch directly it will pull all of dev at the time of the PR into master along with it.

You can selectively merge from the past to the future, but not from the future to the past.

On Wed, Oct 1, 2014 at 11:19 AM, longjon [email protected] wrote:

If it's a clean merge to master, can we not simply merge to master as well?

On Wed, Oct 1, 2014 at 11:13 AM, Evan Shelhamer [email protected]

wrote:

Yeah, we should likely cherry-pick the fix. It'll cause a conflict in the next release merge but oh well.

It's not yet second-nature to merge fixes to master instead, so I've fallen into the same trap with a few recent fixes in dev.

On Wednesday, October 1, 2014, longjon [email protected] wrote:

@shelhamer https://github.com/shelhamer right, this is fixed by #1149 https://github.com/BVLC/caffe/pull/1149. @mlapin https://github.com/mlapin, you should be able to use the fix by merging with master or whatever branch you are on. Note that the original code is wrong, and the proposed solution is also wrong.

@shelhamer https://github.com/shelhamer should we merge this fix also to master? I didn't bother since it seemed like an uncommon thing, but maybe this codepath gets hit more often with the data transformer refactoring...

— Reply to this email directly or view it on GitHub https://github.com/BVLC/caffe/issues/1199#issuecomment-57505156.

— Reply to this email directly or view it on GitHub https://github.com/BVLC/caffe/issues/1199#issuecomment-57510060.

— Reply to this email directly or view it on GitHub https://github.com/BVLC/caffe/issues/1199#issuecomment-57510953.

shelhamer avatar Oct 01 '14 18:10 shelhamer

Ah, of course, I keep forgetting about that.

On Wed, Oct 1, 2014 at 11:38 AM, Evan Shelhamer [email protected] wrote:

The PR was made to dev so you would have to rebase on master or cherry-pick. If you merge the branch directly it will pull all of dev at the time of the PR into master along with it.

You can selectively merge from the past to the future, but not from the future to the past.

On Wed, Oct 1, 2014 at 11:19 AM, longjon [email protected] wrote:

If it's a clean merge to master, can we not simply merge to master as well?

On Wed, Oct 1, 2014 at 11:13 AM, Evan Shelhamer < [email protected]>

wrote:

Yeah, we should likely cherry-pick the fix. It'll cause a conflict in the next release merge but oh well.

It's not yet second-nature to merge fixes to master instead, so I've fallen into the same trap with a few recent fixes in dev.

On Wednesday, October 1, 2014, longjon [email protected] wrote:

@shelhamer https://github.com/shelhamer right, this is fixed by #1149 https://github.com/BVLC/caffe/pull/1149. @mlapin https://github.com/mlapin, you should be able to use the fix by merging with master or whatever branch you are on. Note that the original code is wrong, and the proposed solution is also wrong.

@shelhamer https://github.com/shelhamer should we merge this fix also to master? I didn't bother since it seemed like an uncommon thing, but maybe this codepath gets hit more often with the data transformer refactoring...

— Reply to this email directly or view it on GitHub https://github.com/BVLC/caffe/issues/1199#issuecomment-57505156.

— Reply to this email directly or view it on GitHub https://github.com/BVLC/caffe/issues/1199#issuecomment-57510060.

— Reply to this email directly or view it on GitHub https://github.com/BVLC/caffe/issues/1199#issuecomment-57510953.

— Reply to this email directly or view it on GitHub https://github.com/BVLC/caffe/issues/1199#issuecomment-57513962.

longjon avatar Oct 01 '14 19:10 longjon

Already fixed.

shelhamer avatar Oct 04 '14 05:10 shelhamer