Comments (3)
Line 54 in e0f5d35
By adding the following code to line 54 in test.py, you can save the action maps.
a = action.astype(np.uint8)
a = np.transpose(a, (1,2,0))
cv2.imwrite(SAVE_PATH+str(i)+'_'+str(t)+'_action.png', a)
In the saved action maps, each pixel value has the index of the chosen action.
0: pixel value -= 1
1: do nothing
2: pixel value += 1
3: Gaussian filter (sigma=0.5)
.... (see State.py for more details)
After saving the action maps, we colorized them by (a little modified version of) Pascal VOC color map.
from pixelrl.
move_range
indicates the number of actions that move the pixel values. e.g., when move_range=3
, there are three actions: pixel_value+=1, +=0, and -=1. When move_range=5
, there are five actions: pixel_value +=2, +=1, +=0, -=1, and -=2.
act
is the action map whose element indicates the index of chosen action at each pixel.
Let us consider the case when move_range=3
.
act[b, y, x]
= 0, 1, ... , or 8 where b denotes the b-th image in the minibatch, and y, x denote the indices of row and col, respectively.
At the pixel where act[b, y, x] == 0
, the pixel value is changed 'pixel_value -= 1' (Line 14-17 in State.py ).
Lines 14 to 17 in e0f5d35
Similarly, pixel_value +=0 is performed at the pixel where
act[b, y, x] == 1
, and pixel_value += 1 is performed at the pixel where act[b, y, x] == 2
in Line 14-17. The variable move
is divided by 255 in Line 16 because the pixel values are normalized into the range [0, 1].
act[b, y, x] == 3, 4, 5, 6, ,7 and 8 correspond to each action: Gaussian filter, bilateral filter, median filter, another Gaussian filter (with different parameters), another bilateral filter (with different parameters), and box filter, respectively.
In Line 26-27, Gaussian filter is performed on the entire image if at least one act[b, y, x] == 3 exists. Similar process is performed in Line 28-37.
Finally, in Line 40, the pixel value after Gaussian filter is performed is chosen at the pixel where act[b, y, x] == 3. Similar process of the other filters is performed in Line 41-45.
from pixelrl.
Thank you for the detailed explanation. I hope to generate the action maps to reproduce the Fig.2 and 4 in your 2019 paper. Where would the best place to output them?
from pixelrl.
Related Issues (13)
- Image Restoration and Color Enhancement? HOT 3
- image compression using PixelRL? HOT 1
- Color images? HOT 1
- 3 channel image restoration HOT 1
- Why the FCN needs a pre-trained weight? HOT 7
- Have you used any pre-trained weights for the colour Enhancement part? HOT 4
- Can pixelRL be combined with GAN? HOT 3
- How to run the code in google colab
- How to run in Colab HOT 6
- Regarding Testing Setup HOT 4
- Why did you augment the test set as well as the training set? And why did that boost the performance of your proposed method? HOT 1
- Reward functions used in image denoising
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 pixelrl.