Skip to content
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

fix transform bug when no label #1007

Merged
merged 18 commits into from
May 11, 2021
Merged
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
c8116a4
fix "cross entropy" typo
LutaoChu Dec 22, 2020
0ed9616
Merge branch 'develop' of https://github.com/PaddlePaddle/PaddleSeg i…
LutaoChu Dec 23, 2020
c2cf125
Merge branch 'develop' of https://github.com/PaddlePaddle/PaddleSeg i…
LutaoChu Dec 24, 2020
1cb9317
Remote sensing fitting paddle version 2.0
LutaoChu Dec 24, 2020
81c8bb2
Merge branch 'develop' of https://github.com/PaddlePaddle/PaddleSeg i…
LutaoChu Dec 28, 2020
e566809
Merge branch 'develop' of https://github.com/PaddlePaddle/PaddleSeg i…
LutaoChu Dec 29, 2020
a74b2eb
Merge branch 'develop' of https://github.com/PaddlePaddle/PaddleSeg i…
LutaoChu Jan 27, 2021
ae2db61
Merge branch 'develop' of https://github.com/PaddlePaddle/PaddleSeg i…
LutaoChu Feb 25, 2021
d682ea0
Merge branch 'develop' of https://github.com/PaddlePaddle/PaddleSeg i…
LutaoChu Mar 2, 2021
cadd233
Merge branch 'develop' of https://github.com/PaddlePaddle/PaddleSeg i…
LutaoChu Mar 11, 2021
9a6f9e9
Merge branch 'develop' of https://github.com/PaddlePaddle/PaddleSeg i…
LutaoChu Mar 12, 2021
302c359
Merge branch 'develop' of https://github.com/PaddlePaddle/PaddleSeg i…
LutaoChu Mar 18, 2021
8154ef7
Merge branch 'develop' of https://github.com/PaddlePaddle/PaddleSeg i…
LutaoChu Mar 30, 2021
3f7bb5e
Merge branch 'develop' of https://github.com/PaddlePaddle/PaddleSeg i…
LutaoChu Apr 1, 2021
2da82e7
Merge branch 'develop' of https://github.com/PaddlePaddle/PaddleSeg i…
LutaoChu Apr 1, 2021
6b5c68a
Merge branch 'develop' of https://github.com/PaddlePaddle/PaddleSeg i…
LutaoChu Apr 21, 2021
67db432
Merge branch 'develop' of https://github.com/PaddlePaddle/PaddleSeg i…
LutaoChu May 8, 2021
d87c1f3
fix transform bug when no label
LutaoChu May 8, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 13 additions & 11 deletions paddleseg/transforms/transforms.py
Original file line number Diff line number Diff line change
Expand Up @@ -718,13 +718,14 @@ def __call__(self, im, label=None):
flags=cv2.INTER_LINEAR,
borderMode=cv2.BORDER_CONSTANT,
borderValue=self.im_padding_value)
label = cv2.warpAffine(
label,
r,
dsize=dsize,
flags=cv2.INTER_NEAREST,
borderMode=cv2.BORDER_CONSTANT,
borderValue=self.label_padding_value)
if label is not None:
label = cv2.warpAffine(
label,
r,
dsize=dsize,
flags=cv2.INTER_NEAREST,
borderMode=cv2.BORDER_CONSTANT,
borderValue=self.label_padding_value)

if label is None:
return (im, )
Expand Down Expand Up @@ -778,13 +779,14 @@ def __call__(self, im, label=None):
w1 = np.random.randint(0, img_width - dw)

im = im[h1:(h1 + dh), w1:(w1 + dw), :]
label = label[h1:(h1 + dh), w1:(w1 + dw)]
im = cv2.resize(
im, (img_width, img_height),
interpolation=cv2.INTER_LINEAR)
label = cv2.resize(
label, (img_width, img_height),
interpolation=cv2.INTER_NEAREST)
if label is not None:
label = label[h1:(h1 + dh), w1:(w1 + dw)]
label = cv2.resize(
label, (img_width, img_height),
interpolation=cv2.INTER_NEAREST)
break
if label is None:
return (im, )
Expand Down