zexinyan / medical-report-generation Goto Github PK
View Code? Open in Web Editor NEWA pytorch implementation of On the Automatic Generation of Medical Imaging Reports.
A pytorch implementation of On the Automatic Generation of Medical Imaging Reports.
File "dataset.py", line 135, in
vocab = pickle.load(f)
AttributeError: Can't get attribute 'Vocabulary' on <module 'main' from 'dataset.py'>
When i was traning, I've met a problem that the progress came to a standstill. And I've found that it was the function _epoch_train and _epoch_val stopped it, which raises NotImplementedError. I wonder why and how to fix it.
the v1 function of class CoAttention, v_att is different from the formula in that paper, is there loss a sum function?
def v1(self, avg_features, semantic_features, h_sent) -> object:
"""
only training
:rtype: object
"""
W_v = self.bn_v(self.W_v(avg_features))
W_v_h = self.bn_v_h(self.W_v_h(h_sent.squeeze(1)))
alpha_v = self.softmax(self.bn_v_att(self.W_v_att(self.tanh(W_v + W_v_h))))
v_att = torch.mul(alpha_v, avg_features) # over there...........
W_a_h = self.bn_a_h(self.W_a_h(h_sent))
W_a = self.bn_a(self.W_a(semantic_features))
alpha_a = self.softmax(self.bn_a_att(self.W_a_att(self.tanh(torch.add(W_a_h, W_a)))))
a_att = torch.mul(alpha_a, semantic_features).sum(1)
ctx = self.W_fc(torch.cat([v_att, a_att], dim=1))
return ctx, alpha_v, alpha_a
what is the version of the python and torch ?
I have some bugs when I run the tester.py.
for exmple,
Traceback (most recent call last):
File "tester.py", line 502, in
sampler.generate()
File "tester.py", line 144, in generate
sampled_ids = self.word_model.sample(topic, start_tokens)
File "/home/cheng/perl5/Medical-Report-Generation-master/utils/models.py", line 386, in sample
sampled_ids[:, 0] = start_tokens.view(-1, )
File "/usr/local/lib/python3.6/site-packages/torch/tensor.py", line 452, in array
return self.numpy().astype(dtype, copy=False)
TypeError: can't convert CUDA tensor to numpy. Use Tensor.cpu() to copy the tensor to host memory first.
Hello: Can you conceptually explain how you are implementing stop control across a batch size?
"Pred Sent": {"0": "", "1": "no acute cardiopulmonary abnormality", "2": "", "3": "", "4": "", "5": ""}
不管是什么图片,都是这句no acute cardiopulmonary abnormality。没有出现你那种生成的句子
From where to download the datset, I tried a lot but was unable to find it(i.e data/images folder how to get it)
targets = np.zeros((len(captions), max_sentence_num + 1, max_word_num))
prob = np.zeros((len(captions), max_sentence_num + 1))
When i read the dataset code, i found that the second dim of this two variable added to 1. I don't know why it's set up this way, could anyone help answer this? Thx
i can not find clean_test.json file. from where i can get this file
Figures can not be displayed, can you upload them again, thanks.
TypeError: can't convert cuda:0 device type tensor to numpy. Use Tensor.cpu() to copy the tensor to host memory first.
Thank you for your help!
Is this model avaliable?
Hello and thank you for sharing your work!
Could you please provide the last checkpoint for the pretrained model?
Thank you in advance, Lucia
尝试复现了一下,发现有几个问题(不确定),如遇到相同问题,欢迎讨论。
对于build_vocab.py中的class JsonReader,在构建vocab的时候是没有问题的,但在dataset.py中,self.caption[image_name],image_name已经是图像名称,而不需要像build_vocab.py中用key[序号]来取。
所以我认为在运行trainer.py->dataset.py的时候class JsonReader应该改为如下。实验结束也表明修改之后的 JsonReader才会构造出不是空的target。class JsonReader(object):
def __init__(self, json_file):
self.data = self.__read_json(json_file)
def __read_json(self, filename):
with open(filename, 'r') as f:
data = json.load(f)
return data
def __getitem__(self, item):
return self.data[item]
def __len__(self):
return len(self.data)
和issue #11 中所说的一样,要加上这句话不然状态没法更新只会输出同样的内容。
这里的写法有点不太清楚,只能看到原先被注释掉的。* word_mask).sum() * (0.9 ** word_index),这些的含义是什么?
此代码中,在做多标签分类的时候用的是MSEloss(是可行的,但不知道是否和文中对应);而论文原文中所说的是交叉熵分类(感觉应该用sigmoid+BCELoss?)
文中提到会把image划分成多个region作为输入,但代码中直接使用的是原image(经过了transform操作中的RandomCrop);是直接讲划分成多个region理解为RandomCrop操作吗?还是有另外的操作方式,这里也不是很清楚。
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.