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

Upgrade to tensorflow2 #3

Merged
merged 8 commits into from
Apr 17, 2020
Merged

Upgrade to tensorflow2 #3

merged 8 commits into from
Apr 17, 2020

Conversation

atorch
Copy link
Owner

@atorch atorch commented Mar 22, 2020

  • 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
Copy link
Owner Author

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

Copy link
Owner Author

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)
Copy link
Owner Author

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.

@atorch atorch merged commit 3060b0f into master Apr 17, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant