-
Notifications
You must be signed in to change notification settings - Fork 1
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
Upgrade to tensorflow2 #3
Conversation
atorch
commented
Mar 22, 2020
•
edited
Loading
edited
- I couldn't get class weights to work, so I deleted them and replaced them with temporal sample weights
- I should explain the idea behind masking in the readme: CDL developed contains roads, buildings, and (at 30 meter resolution) many NAIP pixels that are neither roads nor buildings, hence the idea of masking out CDL developed when computing loss.
- Without masking, the model learns to predict developed for pixels near roads. Often, the ground truth is that these pixels are crops or pasture or forest.
- It looks like Keras - how to use class_weight with 3D data keras-team/keras#3653 still has no elegant solution, even with tensorflow2
* I couldn't get class weights to work, so I deleted them for now
) | ||
mask -= cdl_index_indicators | ||
|
||
return K.categorical_crossentropy(y_true, y_pred) * mask |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I got errors here when running fit_model.py on this branch
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I replaced this with temporal sample weights (based on class): see keras-team/keras#3653 (comment)
|
||
# TODO Unused, reimplement this? | ||
cdl_indices_to_mask = label_encoder.transform(CDL_CLASSES_TO_MASK) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Explain the idea behind masking in the readme: CDL developed contains roads, buildings, and (at 30 meter resolution) many NAIP pixels that are neither roads nor buildings, hence the idea of masking out CDL developed when computing loss.
… (for temporal sample weights)