Comments (8)
Yes !!!!
It seems to work now, thank you very much. A small recap for the people that can be interested:
----- File generator.py:
- Read tif images
#self.image_paths = list(Path(image_dir).glob("*.jpg"))
self.image_paths = list(Path(image_dir).glob("*.tif"))
- Fill empty data
#x = np.zeros((batch_size, image_size, image_size, 3), dtype=np.uint8)
#y = np.zeros((batch_size, image_size, image_size, 3), dtype=np.uint8)
x = np.zeros((batch_size, image_size, image_size, 1), dtype=np.uint16)
y = np.zeros((batch_size, image_size, image_size, 1), dtype=np.uint16)
- open the image through opencv
#image = cv2.imread(str(image_path))
image = np.expand_dims(cv2.imread(str(image_path), cv2.IMREAD_ANYDEPTH), -1)
and also
#y = cv2.imread(str(image_path))
y = np.expand_dims(cv2.imread(str(image_path), cv2.IMREAD_ANYDEPTH), -1)
----- File model.py
Just change the default SRResNet default channel
#def get_srresnet_model(input_channel_num=3, feature_dim=64, resunit_num=16):
def get_srresnet_model(input_channel_num=1, feature_dim=64, resunit_num=16):
Well thanks again 👍
from noise2noise.
I did not check the code but please try:
x = np.zeros((batch_size, image_size, image_size), dtype=np.uint8)
y = np.zeros((batch_size, image_size, image_size), dtype=np.uint8)
instead of
x = np.zeros((batch_size, image_size, image_size, 3), dtype=np.uint8)
y = np.zeros((batch_size, image_size, image_size, 3), dtype=np.uint8)
Some noise models might not work due to the number of channels.
from noise2noise.
Hi,
Thank for your suggestion we made one step ahead, I have made also some other modification to reach my goal but still missing something:
ValueError: Error when checking input: expected input_1 to have 4 dimensions, but got array with shape (8, 128, 128)
I include my modified python files:
noise2noise.zip
Thanks in advance
Carlo
from noise2noise.
Okey, please try:
image = np.expand_dims(cv2.imread(str(image_path), cv2.IMREAD_ANYDEPTH), -1)
...
x = np.zeros((batch_size, image_size, image_size, 1), dtype=np.uint8)
y = np.zeros((batch_size, image_size, image_size, 1), dtype=np.uint8)
from noise2noise.
Thanks a lot, I had the same problem and your solution solved it. :)
from noise2noise.
Hi! I was happy too early. After the first 1000 steps, the training broke up and I got the following messages:
File "/net/home/Dokumente/PA/virtualenv/lib/python3.6/site-packages/keras/engine/training.py", line 1418, in fit_generator
initial_epoch=initial_epoch)
File "/net/home/Dokumente/PA/virtualenv/lib/python3.6/site-packages/keras/engine/training_generator.py", line 234, in fit_generator
workers=0)
File "/net/home/Dokumente/PA/virtualenv/lib/python3.6/site-packages/keras/legacy/interfaces.py", line 91, in wrapper
return func(*args, **kwargs)
File "/net/home/Dokumente/PA/virtualenv/lib/python3.6/site-packages/keras/engine/training.py", line 1472, in evaluate_generator
verbose=verbose)
File "/net/home/Dokumente/PA/virtualenv/lib/python3.6/site-packages/keras/engine/training_generator.py", line 346, in evaluate_generator
outs = model.test_on_batch(x, y, sample_weight=sample_weight)
File "/net/home/Dokumente/PA/virtualenv/lib/python3.6/site-packages/keras/engine/training.py", line 1250, in test_on_batch
sample_weight=sample_weight)
File "/net/home/Dokumente/PA/virtualenv/lib/python3.6/site-packages/keras/engine/training.py", line 751, in _standardize_user_data
exception_prefix='input')
File "/net/home/Dokumente/PA/virtualenv/lib/python3.6/site-packages/keras/engine/training_utils.py", line 128, in standardize_input_data
'with shape ' + str(data_shape))
ValueError: Error when checking input: expected input_1 to have 4 dimensions, but got array with shape (1, 176, 512)
I have no idea, where this shape comes from. I included the changes you said, Barbaretto80, but I use STFTs of speech signals, therefore my dtype is np.float64. Can the type be the reason for the error?
from noise2noise.
You might have to do the same thing to ValGenerator:
https://github.com/yu4u/noise2noise/blob/master/generator.py#L63-L65
The shape seems to come from y = y[:(h // 16) * 16, :(w // 16) * 16]
.
from noise2noise.
Hello,
I've implemented Barbetto80's changes as I'm also interested in working with 16bit TIFF images. After running the following line:
python3 train.py --image_dir train --test_dir test --image_size 256 --batch_size 4 --lr 0.001 --output_path gaussian
The script goes through the first 1000 steps of the first epoch but then I get this error:
F tensorflow/stream_executor/cuda/cuda_dnn.cc:91] Check failed: narrow == wide (-1673887744 vs. 2621079552)checked narrowing failed; values not equal post-conversion
/usr/local/bin/assign-gpu: line 23: 388324 Aborted (core dumped) /usr/bin/numactl --cpunodebind="${CUDA_VISIBLE_DEVICES}" --membind="${CUDA_VISIBLE_DEVICES}" $@
The gaussian folder is created but is empty.
The training and testing TIFF images are 4700x8742 pixels and 78MB in size.
I was wondering if you could help with this. Thanks!
from noise2noise.
Related Issues (20)
- Already have Input-Output Noisy Pairs HOT 1
- Hi ! Any kinds of pictures can be fit for your net? HOT 12
- How do I get this to work and can it work for what I want it to? HOT 8
- How do clean document scans with this? HOT 1
- How do I use the trained model file to remove noise from my photos? HOT 1
- How to modify random text noise for custom image noise? HOT 1
- can this use in point cloud denoising? HOT 1
- I want to use our own noisy data to train the model HOT 3
- Tensorflow error HOT 5
- run error
- AttributeError: module 'tensorflow' has no attribute 'log' HOT 2
- Can not generate the weight file when use my train images HOT 4
- remove other watermarking HOT 2
- Deleting dataset causes error (Google Colab) HOT 2
- I have GPU GeForce GTX 1050 and 32GB RAM but still issuse of OOM HOT 2
- one-dimensional data instead of pictures HOT 1
- There's some problem in the training process
- EEE students, Beginners in the field need assistance
- loss nan or inf HOT 7
- > @HongChow
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 noise2noise.