zilongzhong / SSRN

This is a tensorflow and keras based implementation of SSRNs in the IEEE T-GRS paper "Spectral-Spatial Residual Network for Hyperspectral Image Classification: A 3-D Deep Learning Framework".
Other
212 stars 74 forks source link

How to show every class ? #15

Open Aaron1993 opened 5 years ago

Aaron1993 commented 5 years ago

Hi. I want to show every class color map like this, how I can to do it .thanks. image

zilongzhong commented 5 years ago

https://github.com/zilongzhong/SSRN/blob/f6ee47e10273630f8a5981df2d757bbea9beb950/Classification%20Maps/IN_classification_maps.py#L229 Before executing this above line, you can mask out all the classes you don't want to get a class-wise color map. For example, mask = y[y==certain_class] new_y = mask * y

On Thu, 18 Jul 2019 at 09:30, Aaron notifications@github.com wrote:

Hi. I want to show every class color map like this, how I can to do it .thanks. [image: image] https://user-images.githubusercontent.com/14315152/61461418-37a78680-a9a3-11e9-8222-cd7b494f9c9a.png

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/zilongzhong/SSRN/issues/15?email_source=notifications&email_token=AD2DHTWASKLEBOCG2GBHYV3QABV7DA5CNFSM4IE23HY2YY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4HAAELEQ, or mute the thread https://github.com/notifications/unsubscribe-auth/AD2DHTVG2IAAXMD7HQDRXP3QABV7DANCNFSM4IE23HYQ .

Aaron1993 commented 5 years ago

It has an error in line new_y = mask * y, the error is new_y = mask * y ValueError: operands could not be broadcast together with shapes (12518,) (21025,3)

zilongzhong commented 5 years ago

https://github.com/zilongzhong/SSRN/blob/f6ee47e10273630f8a5981df2d757bbea9beb950/Classification%20Maps/IN_classification_maps.py#L189 Use the following snipt after the above line: mask = x[x==certain_class] x= mask * x

Aaron1993 commented 5 years ago

There is the same error in x=mask * x, whether certain_class is the class number, for example certain_class==1?

zilongzhong commented 5 years ago

Yes, you can select which class to show.

Aaron1993 commented 5 years ago

But the error x = mask * x ValueError: operands could not be broadcast together with shapes (12518,) (21025,3) show in this line.

zilongzhong commented 5 years ago

You can use print (x.shape) to make sure x is a one-dimension vector debug the issue, and get rid of the lines of "mask = y[y!=certain_class]; new_y = mask y". Then, updated the snippet as follows: mask = -1 x[x!=certain_class] x= mask * x

On Mon, 22 Jul 2019 at 03:30, Hailong Su notifications@github.com wrote:

But the error x = mask * x ValueError: operands could not be broadcast together with shapes (12518,) (21025,3) show in this line.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/zilongzhong/SSRN/issues/15?email_source=notifications&email_token=AD2DHTXQO4ZPY7CUALXVOPLQAVO2HA5CNFSM4IE23HY2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD2PA5MY#issuecomment-513674931, or mute the thread https://github.com/notifications/unsubscribe-auth/AD2DHTUY4ITJ2KINSCL5M6LQAVO2HANCNFSM4IE23HYQ .