Comments (4)
I have tested the code for sure. The Tensorflow version gives an exact numerical answer as the Pytorch version. Code for test attached below:
from focal_frequency_loss import FocalFrequencyLoss as FFL
from tf_focal_frequency_loss import FocalFrequencyLoss as TFFL
# Pytorch
import torch
ffl = FFL(loss_weight=1.0, alpha=1.0) # initialize nn.Module class
fake = torch.randn(4, 3, 64, 64)
real = torch.randn(4, 3, 64, 64)
pt_loss = ffl(fake, real) # calculate focal frequency loss
# Tensorflow
import tensorflow as tf
tffl = TFFL(loss_weight=1.0, alpha=1.0) # initialize tf.keras.layers.Layer class
fake = tf.convert_to_tensor(fake.numpy(), tf.float32)
real = tf.convert_to_tensor(real.numpy(), tf.float32)
tf_loss = tffl(fake, real) # calculate focal frequency loss
# Check
import numpy as np
assert np.isclose(pt_loss.numpy(), tf_loss.numpy()) , "Results don't match"
I have trained a Pix2Pix model using this tensorflow implementation and it does give better results (compared to training without it), but I haven't recreated the official repo results to compare its performance.
from focal-frequency-loss.
Thanks a lot for the nice support. I have already mentioned this unofficial TensorFlow implementation in our README.
from focal-frequency-loss.
Thank you so much for the nice TensorFlow implementation! Have you tested the code and its performance compared with this official repo?
from focal-frequency-loss.
Thanks a lot for the support.
from focal-frequency-loss.
Related Issues (13)
- Train problem HOT 2
- code about other algorithms
- Training probelm HOT 2
- a question about ffl value HOT 1
- Welcome update to OpenMMLab 2.0
- About use HOT 1
- Will you support pytorch>1.7.1 ? HOT 6
- Can you share the core code of SPADE experiment? thank you
- Deceive D: Adaptive Pseudo Augmentation for GAN Training with Limited Data HOT 1
- the spectra of images HOT 2
- stylegan2 training config
- About the calculation of distance HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from focal-frequency-loss.