tr-misr's People
tr-misr's Issues
What is wrong with augmentation code (Why not to use it?)
`
##########` need to fix, and do not use it ##########
# data_arguments, we need to process padded_lr_batch, padded_lm_batch, hr_batch, hm_batch
if self.config["training"]["data_arguments"]:
# print(padded_lr_batch.shape) # [12,16,64,64]
# print(padded_lm_batch.shape) # [12,16,64,64]
# print(hr_batch.shape) # [12,192,192]
# print(hm_batch.shape) # [12,192,192]
np.random.seed(int(1000 * time.time()) % 2**32)
if np.random.random() <= self.config["training"]["probability of flipping horizontally"]:
padded_lr_batch = torch.flip(padded_lr_batch, [3]) # Horizontal flip of lr images
padded_lm_batch = torch.flip(padded_lm_batch, [3]) # Horizontal flip of lm images
hr_batch = torch.flip(hr_batch, [2]) # Horizontal flip of hr images
hm_batch = torch.flip(hm_batch, [2]) # Horizontal flip of hm images
np.random.seed(int(1000 * time.time()) % 2**32)
if np.random.random() <= self.config["training"]["probability of flipping vertically"]:
padded_lr_batch = torch.flip(padded_lr_batch, [2]) # Vertical flip of lr images
padded_lm_batch = torch.flip(padded_lm_batch, [2]) # Vertical flip of lm images
hr_batch = torch.flip(hr_batch, [1]) # Horizontal flip of hr images
hm_batch = torch.flip(hm_batch, [1]) # Horizontal flip of hm images
np.random.seed(int(1000 * time.time()) % 2**32)
k_num = np.random.choice(a=self.config["training"]["corresponding angles(x90)"],
replace=True,
p=self.config["training"]["probability of rotation"])
padded_lr_batch = torch.rot90(padded_lr_batch, k=k_num, dims=[2,3]) # Rotate k times ninety degrees counterclockwise of lr images
padded_lm_batch = torch.rot90(padded_lm_batch, k=k_num, dims=[2,3]) # Rotate k times ninety degrees counterclockwise of lm images
hr_batch = torch.rot90(hr_batch, k=k_num, dims=[1,2]) # Rotate k times ninety degrees counterclockwise of hr images
hm_batch = torch.rot90(hm_batch, k=k_num, dims=[1,2]) # Rotate k times ninety degrees counterclockwise of hm images
np.random.seed(int(1000 * time.time()) % 2**32)
There is a comment saying not to use the augmentation and I don't know what is the problem in using it (I could not detect from code tracing). So can you explain me the problem occuring ?
stack expects each tensor to be equal size
I got this error while running the train.py. How can i get the equal sizes?
File "/home/uzma/.local/lib/python3.6/site-packages/torch/_utils.py", line 434, in reraise
raise exception
RuntimeError: Caught RuntimeError in DataLoader worker process 0.
Original Traceback (most recent call last):
File "/home/uzma/.local/lib/python3.6/site-packages/torch/utils/data/_utils/worker.py", line 287, in _worker_loop
data = fetcher.fetch(index)
File "/home/uzma/.local/lib/python3.6/site-packages/torch/utils/data/_utils/fetch.py", line 52, in fetch
return self.collate_fn(data)
File "/home/uzma/TR-MISR/src/utils.py", line 65, in call
return self.collateFunction(batch)
File "/home/uzma/TR-MISR/src/utils.py", line 114, in collateFunction
padded_lr_batch = torch.stack(lr_batch, dim=0)
RuntimeError: stack expects each tensor to be equal size, but got [24, 32, 32] at entry 0 and [24, 32, 64] at entry 1
A GDAL API version must be specified
I'm trying to install you requirements, I created a python 3.6 environment and ran pip install -r requirements.txt
but fiona doesn't install, pip seems to find the right version but can't install it:
(py36) h:\git\TR-MISR>pip install -r requirements.txt
Collecting click==7.1.2
Using cached click-7.1.2-py2.py3-none-any.whl (82 kB)
Collecting einops==0.3.0
Using cached einops-0.3.0-py2.py3-none-any.whl (25 kB)
Collecting fiona==1.8.18
Using cached Fiona-1.8.18.tar.gz (1.3 MB)
ERROR: Command errored out with exit status 1:
command: 'h:\Anaconda3\envs\py36\python.exe' -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\Greg\\AppData\\Local\\Temp\\pip-install-c0jgax2y\\fiona_daff91fafc604d3d9fef1b100c5ee3d8\\setup.py'"'"'; __file__='"'"'C:\\Users\\Greg\\AppData\\Local\\Temp\\pip-install-c0jgax2y\\fiona_daff91fafc604d3d9fef1b100c5ee3d8\\setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base 'C:\Users\Greg\AppData\Local\Temp\pip-pip-egg-info-5t9gz38j'
cwd: C:\Users\Greg\AppData\Local\Temp\pip-install-c0jgax2y\fiona_daff91fafc604d3d9fef1b100c5ee3d8\
Complete output (1 lines):
A GDAL API version must be specified. Provide a path to gdal-config using a GDAL_CONFIG environment variable or use a GDAL_VERSION environment variable.
----------------------------------------
WARNING: Discarding https://files.pythonhosted.org/packages/9f/e8/401cdaa58d862a25c4b3365acf7d2bd7ac77191e3dc9acdcdac0eff20ff0/Fiona-1.8.18.tar.gz#sha256=b732ece0ff8886a29c439723a3e1fc382718804bb057519d537a81308854967a (from https://pypi.org/simple/fiona/). Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
ERROR: Could not find a version that satisfies the requirement fiona==1.8.18 (from versions: 0.5, 0.6, 0.6.1, 0.6.2, 0.7, 0.8, 0.9, 0.9.1, 0.10, 0.12, 0.12.1, 0.13, 0.14, 0.15, 0.16, 0.16.1, 1.0, 1.0.1, 1.0.2, 1.0.3, 1.1, 1.1.1, 1.1.2, 1.1.3, 1.1.4, 1.1.5, 1.1.6, 1.2.0, 1.3.0, 1.4.0, 1.4.1, 1.4.2, 1.4.3, 1.4.4, 1.4.5, 1.4.6, 1.4.7, 1.4.8, 1.5.0, 1.5.1, 1.6.0, 1.6.1, 1.6.2, 1.6.3, 1.6.3.post1, 1.6.4, 1.7b1, 1.7.0, 1.7.0.post2, 1.7.1, 1.7.1.post1, 1.7.2, 1.7.3, 1.7.4, 1.7.5, 1.7.6, 1.7.7, 1.7.8, 1.7.9, 1.7.9.post1, 1.7.10, 1.7.10.post1, 1.7.11, 1.7.11.post1, 1.7.11.post2, 1.7.12, 1.7.13, 1.8a1, 1.8a2, 1.8a3, 1.8b1, 1.8b2, 1.8rc1, 1.8.0, 1.8.1, 1.8.2, 1.8.3, 1.8.4, 1.8.5, 1.8.6, 1.8.7, 1.8.8, 1.8.9, 1.8.9.post1, 1.8.9.post2, 1.8.10, 1.8.11, 1.8.12, 1.8.13, 1.8.13.post1, 1.8.14, 1.8.15, 1.8.16, 1.8.17, 1.8.18, 1.8.19, 1.8.20, 1.8.21)
ERROR: No matching distribution found for fiona==1.8.18
Do you have an idea ?
RuntimeError: stack expects each tensor to be equal size, but got [24, 32, 64] at entry 0 and [24, 64, 32] at entry 1
I got that error during running train.py. I couldn't know how to solve it
This is also the trace back:
RuntimeError: Caught RuntimeError in DataLoader worker process 0.
Original Traceback (most recent call last):
File "C:\Users\user\anaconda3\envs\endo\lib\site-packages\torch\utils\data_utils\worker.py", line 302, in _worker_loop
data = fetcher.fetch(index)
File "C:\Users\user\anaconda3\envs\endo\lib\site-packages\torch\utils\data_utils\fetch.py", line 52, in fetch
return self.collate_fn(data)
File "C:\Users\user\Desktop\TR-MISR-master\src\utils.py", line 65, in call
return self.collateFunction(batch)
File "C:\Users\user\Desktop\TR-MISR-master\src\utils.py", line 118, in collateFunction
padded_lr_batch = torch.stack(lr_batch, dim=0)
RuntimeError: stack expects each tensor to be equal size, but got [24, 32, 64] at entry 0 and [24, 64, 32] at entry 1
您好,请问为什么这里的srs要截取在0,16383/65535之间呢,16383是怎么得到的呢
compute ESA score
srs = srs[0].detach().cpu().numpy() #detach(): 返回一个新的Tensor,但返回的结果是没有梯度的。cpu():把gpu上的数据转到cpu上 numpy():将tensor格式转为numpy。
for i in range(srs.shape[0]):
if baseline_cpsnrs is None:
if config["training"]["truncate values"]:
val_score -= shift_cPSNR(np.clip((srs[i] - np.min(srs[i])), 0, 16383/65535), hrs[i], hr_maps[i])
else:
val_score -= shift_cPSNR(srs[i], hrs[i], hr_maps[i])
else:
ESA = baseline_cpsnrs[names[i]]
# val_score += ESA / shift_cPSNR(srs[i], hrs[i], hr_maps[i])
if config["training"]["truncate values"]:
val_score -= shift_cPSNR(np.clip((srs[i] - np.min(srs[i])), 0, 16383/65535), hrs[i], hr_maps[i])
else:
val_score -= shift_cPSNR(srs[i], hrs[i], hr_maps[i])
ZeroDivisionError: float division by zero
When I run the train.py script with the probav_data
i get this:
(py39) h:\git\TR-MISR>python ./src/train.py
loss: -4.4875
loss: -15.8379
100%|█████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 2/2 [02:56<00:00, 88.34s/it]
0%| | 0/400 [03:01<?, ?it/s]
Traceback (most recent call last):
File "h:\git\TR-MISR\src\train.py", line 302, in <module>
main(config)
File "h:\git\TR-MISR\src\train.py", line 289, in main
trainAndGetBestModel(fusion_model, optimizer, dataloaders, baseline_cpsnrs, config)
File "h:\git\TR-MISR\src\train.py", line 173, in trainAndGetBestModel
val_score /= len(dataloaders['val'].dataset)
ZeroDivisionError: float division by zero
Maybe because there's nothing in the split_data/val folder ?
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.