Comments (12)
Hi @lbc402, I just upload the model to Kaggle, you can check out here
from chestx-ray-14.
@lbc402, did you load the pretrained model? the code to load is here
The model I uploaded is intended for the web demo, so it is not loaded by default.
from chestx-ray-14.
Thank to your reply. I'm not sure the link you provided is publicly accessible. In fact, I can't seem to open it.
from chestx-ray-14.
Hi @lbc402, I just make it publicly available, you can download the model now.
from chestx-ray-14.
Sorry @dattran2346 ,When I execute the code in cropped lung.ipynb, the returned py variable is a zero matrix.
d = {}
distorted_lung = []
for image_name in tqdm(image_names):
image = Image.open(PATH/IMAGE_DN/image_name).convert('RGB')
py = unet(V(tfm(image)[None]))
I confirm that there is no problem with the input image. So I want to confirm with you whether the unet.h5 you provided is correct.
from chestx-ray-14.
I got it. I'm sure the model is loaded. In fact, the chexnet model can run successfully.
from chestx-ray-14.
The problem is to execute such a piece of code
unet = Unet(trained=True, model_name=unet_model).cuda()
unet.eval();
……
image = Image.open(PATH/IMAGE_DN/image_name).convert('RGB')
unet(V(tfm(image)[None]))
And then we get this result
tensor([[[[0.0000, 0.0000, 0.0000, ..., 0.0000, 0.0000, 0.0000],
[0.0000, 0.0000, 0.0000, ..., 0.0000, 0.0000, 0.0000],
[0.0000, 0.0000, 0.0000, ..., 0.0000, 0.0000, 0.0000],
...,
[0.0000, 0.0000, 0.0000, ..., 0.0000, 0.0000, 0.0000],
[0.0000, 0.0000, 0.0000, ..., 0.0000, 0.0000, 0.0000],
[0.0000, 0.0000, 0.0000, ..., 0.0000, 0.0000, 0.0000]]]],
device='cuda:0', grad_fn=<ReluBackward>)
from chestx-ray-14.
@lbc402, does the result from unet model are all zeros? Is the tfm
working correctly, i.e, the image is properly normalized?
from chestx-ray-14.
@dattran2346 Yes, I got all zero results. I used the initialization parameters you defined, which seems to be no problem.
normalize = transforms.Normalize(IMAGENET_MEAN, IMAGENET_STD)
toTensor = transforms.ToTensor()
tfm = transforms.Compose([
transforms.Resize((256, 256)),
toTensor,
normalize
])
I would like to ask you to confirm that this Unet model is the best model?
from chestx-ray-14.
@lbc402 I only keep the best single model, so yes, it is. But you're getting all zeros, which is quite interesting.
from chestx-ray-14.
@lbc402, I just checked the model, it's not all zeros. You should check the min and max value of the mask
Here is the working code
image = Image.open('/mnt/DATA/kaggle/siim/images/test/1.2.276.0.7230010.3.1.4.8323329.6249.1517875197.290574.jpg').convert('RGB')
image = Variable(tfm(image)[None])
py = torch.sigmoid(unet(image))
py = (py[0].cpu() > 0.5).type(torch.FloatTensor)
plt.imshow(py.numpy()[0])
from chestx-ray-14.
@dattran2346 Thank you very much. What a naive question I have.
from chestx-ray-14.
Related Issues (6)
- Issue in set up HOT 1
- best.h5 file HOT 3
- Further Clarifications HOT 3
- pil_image.size gives (w,h) and not (h,w) HOT 1
- usage of masks in training HOT 1
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 chestx-ray-14.