F_signal = torch.fft.rfft(signal])
w = ((((torch.arange(0,301))/600)*(2*torch.pi))) #signal is 600 samples long
d_signal = torch.fft.irfft(w*torch.tensor(complex(0,1))*F_signal)*(1/dt)
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
#We only need to normalize the inputs of a neural network, not necessarily the outputs. | |
#However, the choice of the activation function is important, e.g. it doesn't work with `jnp.tanh`. | |
import jax.numpy as jnp | |
from jax import grad, jit, vmap | |
import jax | |
from jax import random | |
from flax import linen as nn | |
from flax.training import train_state | |
from optax import adam |
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
Copyright 2023 Andras Retzler | |
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: | |
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. | |
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OT |
% Set figure size and save
set(gcf, 'Position', [1 1 900 250]);
fig = gcf;
fig.PaperUnits = 'points';
fig.PaperPosition = [0 0 fig.Position(3) fig.Position(4)];
fig.PaperSize = [fig.Position(3) fig.Position(4)];
fig.PaperPositionMode = 'auto';
fig_pos = fig.PaperPosition;
fig.PaperSize = [fig_pos(3) fig_pos(4)];
Scalar value for argument 'color' is not numeric
I got this with OpenCV 4.2.0 from cv2.rectangle
, where start_point
was a list, end_point
was a tuple:
cv2.rectangle(rect_mask, start_point_2, end_point, 1, -1)
To fix:
cv2.rectangle(rect_mask, tuple(start_point_2), end_point, 1, -1)
OlderNewer