Skip to content

Number of classes assertion error #2001

Closed Answered by AdeelH
lcoandrade asked this question in Q&A
Discussion options

You must be logged in to vote

The 255 you were seeing before wasn't because you were subclassing, but rather because your label files were pre-chipped RGB images with pixel values in the range 0-255.

In the present case, the labels are not pre-chipped and are single-band but still 0-255. Since we are reading them via a RasterSource, we can take advantage of the ReclassTransformer:

from rastervision.core.data import ReclassTransformer
...
dataset = SemanticSegmentationRandomWindowGeoDataset.from_uris(
    ...,
    label_raster_source_kw=dict(raster_transformers=[ReclassTransformer({255: 1})])
)

Replies: 2 comments 3 replies

Comment options

You must be logged in to vote
2 replies
@lcoandrade
Comment options

@AdeelH
Comment options

Answer selected by lcoandrade
Comment options

You must be logged in to vote
1 reply
@AdeelH
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants