This file contains 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
#! /usr/bin/env python | |
# ============================================================================== | |
# Copyright (c) 2023, Ko Sugawara | |
# All rights reserved. | |
# | |
# Redistribution and use in source and binary forms, with or without | |
# modification, are permitted provided that the following conditions are met: | |
# | |
# 1. Redistributions of source code must retain the above copyright notice, | |
# this list of conditions and the following disclaimer. |
This file contains 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
#!/usr/bin/env python | |
import argparse | |
from pathlib import Path | |
from timagetk.io import imread | |
from timagetk.io import imsave | |
def main(args): | |
pin = Path(args.input) |
This file contains 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
# code picked up from https://github.com/keras-team/keras/blob/master/keras/backend/tensorflow_backend.py | |
# Just used tf.nn.weighted_cross_entropy_with_logits instead of tf.nn.sigmoid_cross_entropy_with_logits with input pos_weight in calculation | |
import tensorflow as tf | |
from keras import backend as K | |
""" Weighted binary crossentropy between an output tensor and a target tensor. | |
# Arguments | |
pos_weight: A coefficient to use on the positive examples. | |
# Returns |