This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from keras import backend as K | |
| def jaccard_distance_loss(y_true, y_pred, smooth=100): | |
| """ | |
| Jaccard = (|X & Y|)/ (|X|+ |Y| - |X & Y|) | |
| = sum(|A*B|)/(sum(|A|)+sum(|B|)-sum(|A*B|)) | |
| The jaccard distance loss is usefull for unbalanced datasets. This has been | |
| shifted so it converges on 0 and is smoothed to avoid exploding or disapearing | |
| gradient. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # A trick to embed preprocessors in cython | |
| cdef extern from *: | |
| cdef void EMIT_IF_PYTHON_VERSION_HEX_LT_37 "#if PY_VERSION_HEX < 0x03070000 //" () | |
| cdef void EMIT_ELSE "#else //" () | |
| cdef void EMIT_ENDIF "#endif //" () | |
| EMIT_IF_PYTHON_VERSION_HEX_LT_37() | |
| EMIT_ELSE() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #ifndef _POLYNOMIAL_REGRESSION_H | |
| #define _POLYNOMIAL_REGRESSION_H __POLYNOMIAL_REGRESSION_H | |
| /** | |
| * PURPOSE: | |
| * | |
| * Polynomial Regression aims to fit a non-linear relationship to a set of | |
| * points. It approximates this by solving a series of linear equations using | |
| * a least-squares approach. | |
| * | |
| * We can model the expected value y as an nth degree polynomial, yielding |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* | |
| parameter JSON | |
| { | |
| "num_layers": 5, | |
| "min_scale": 0.1171875, | |
| "max_scale": 0.75, | |
| "input_size_height": 256, | |
| "input_size_width": 256, | |
| "anchor_offset_x": 0.5, | |
| "anchor_offset_y": 0.5, |
OlderNewer