Comments (5)
Great question. The anwser is yes, in my opinion. Actually, such image representation was very popular on the early-stage computers, which only owns limited bits to store the color information. The quantized image sometims also has the colour banding effects.
As well, I suggest to re-cluster these base colors to seek better performance while you apply them into other domains.
from ict.
Thank you for quick response.
I would try it on paintings or comics, but I think it would require reclustering for better performance.
Could you share your clustering code that produces the kmeans_centers.npy
?
from ict.
Well, in my project of inpainting for medical images, reclustering is essential for greyscale medical images. Maybe code sharing is not essential, but the meaning of each element in kmeans_centers.npy is needed. After I print the loading result from numpy, I see that there are some negative values in this cluster result. However, from the sentence "using KMeans cluster centers of the whole ImageNet [8] RGB pixel spaces. ", I could not figure out if each column of three elements mean RGB color, why it is not in the range of [0, 255] or in the range of [0, 1]. Is it come from the value range of [0, 255] of each channel and then normalized to [-1, 1]? Maye I need some hints~ Greatly thankful for your help!
from ict.
I have rechecked the code and found the key to my question.
Acually, the normalization method does not count too much. The code here define a correct relationship between the color of each pixel and the nearest cluster center. As there are 512 cluster centers, the color will be compressed as the value of the index of cluster center. For example, if the img size is 32*32, the a[:] in the dataset will be a (1024,) shape tensor and each element shows the color of one corresponding pixel.
C = np.load('kmeans_centers.npy') ## [0,1] C = np.rint(127.5 * (C + 1.0)) C = torch.from_numpy(C)
from the code in the post preocessing in inference.py under transformers dir,
we can see the conversion from [-1, 1] range np array to [0, 255] color
So if you don't want to change this conversion method, you can just reverse this prcoess to have correct cluster npy file.
You can also change the rules of conversion by change the code here and the rule of generating npy arrays.
I guess this issue can be closed now.
Clustering methods can be easily accessed in the Insternet. Just be careful about the rule of generating npy array.
from ict.
The kmeans npy is not in the range of [0, 1] as the annotation when I load it, please check whether there is mistake here. From the conversion rule, if C=-1, it's 0 after conversion, and the result is correct in the range of [0, 255] if the npy array is in the range of [-1, 1].
from ict.
Related Issues (20)
- RuntimeError: Expected object of scalar type Long but got scalar type Float for argument HOT 2
- weights HOT 1
- Unzip ckpts_ICT.zip error! HOT 1
- About the test HOT 2
- About the number of GPUS. HOT 2
- About the validation_path of Transformer training. HOT 2
- About the test effect is not good HOT 3
- About the missing parameter 'loader' in Guided Upsampling when inference is done HOT 2
- Enable --random_stroke option but the mask path is still the default
- ### Something Wrong ### HOT 1
- What's wrong with the results?
- Pretrained weight of upsampler of Places does not work well. HOT 1
- About mask ratio of the pretrained models
- ProcessExitedException: process 0 terminated with signal SIGKILL HOT 3
- New easy to use inpanting method with transformers
- Downloading pretrained models from a non-Baidu source
- ProcessExitedException: process 0 terminated with signal SIGKILL #38
- where is the mask path
- TypeError: 'NoneType' object does not support item assignment
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 ict.