Giter Club home page Giter Club logo

unet's People

Contributors

zhixuhao avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

unet's Issues

预测结果

你好,为什么我预测的图片不是二值的

how can i visually test whether my training is right? and how can i train a model use my own data image?

hi, @zhixuhao , i am learning Fcn to realize semantic segmentation. i followed your tutorial and finished training, but after i ran the test_predict.py, there were no image coming out, so how can i visually test whether my training is right?
if i want to train a model use my own data picture, how can i create my own dataset that can be used in you unet.py? could you teach me ? if it`s convenient for you, i want to be a qq friend with you. My qq
is 946614082.

question about u-net

Dear, I think your architecture of u-net is not correct for the beginning layers. I use it to train the same dataset, but the loss doesn't converge.Could you upload your trained model?Thank you!

2D Cropping

Hi,

Thanks for your Code. I tried to alternatively use the "u-net with crop" section from your code and tried to apply this to the same dataset listed in your readme file but I always get this error:

ValueError: Error when checking target: expected conv2d_24 to have shape (None, 322, 322, 1) but got array with shape (31, 512, 512, 1)

I am still rather new to using Keras and was wondering if this failure is due to the values set for cropping?

Any clues would be much appreciated!

about the init

Hi,

Thanks for this implementation.But when i run unet.py,there was something wrong.can you give me some suggestions?thank you very much!
Using TensorFlow backend.
loading data

load train images...

/home/test/Desktop/unet-masters/data.py:216: RuntimeWarning: Mean of empty slice.
mean = imgs_train.mean(axis=0)
/usr/local/lib/python2.7/dist-packages/numpy/core/_methods.py:73: RuntimeWarning: invalid value encountered in true_divide
ret, rcount, out=ret, casting='unsafe', subok=False)

load test images...

/home/test/Desktop/unet-masters/data.py:230: RuntimeWarning: Mean of empty slice.
mean = imgs_test.mean(axis=0)
loading data done
Traceback (most recent call last):
File "unet.py", line 168, in
myunet.train()
File "unet.py", line 152, in train
model = self.get_unet()
File "unet.py", line 85, in get_unet
conv1 = Conv2D(64, 3, activation='relu', padding='same', kernel_initializer='he_normal')(inputs)
TypeError: init() takes at least 4 arguments (4 given)

Traceback (most recent call last):

Traceback (most recent call last):
File "/home/panpan/Desktop/unet-master/main.py", line 15, in
model = unet()
File "/home/panpan/Desktop/unet-master/model.py", line 35, in unet
merge6 = merge([drop4,up6], mode = 'concat', concat_axis = 3)
TypeError: 'module' object is not callable
您好,我刚接触这块,基础较弱;
我不知道为什么会有这个错误,找了很多关于这个的错误,也是不可以。您能告诉我怎么修改么

failed to open 0.tif

I also Failed to open file '/unet-master/train0.tif'. Could you please tell me how to deal with this problem?

如何拓展到3Dunet?

谢谢楼主的分享,你写的这个代码简单易懂,请问应该如何拓展到3D U-NET?不知道楼主有没有这方面的经验?

sir, need help for my wrong result.

Thx for your git program, I start to learn FCN from your keras Unet. I am a student from NEU china.
I use your network to retrain on the given data, but I just get a 0.78 accuracy, it seems that the net can not learn anything after a fever epochs,the accuracy remains 0.78+ while loss can simultaneously be decreased , my batchsize=5,lr=0.001, and I just use 330 augmented pics. Why ? is it being incorrectly initialized?

How to get started?

I'm a beginner and want to ask a simple question.
I'm trying to run the code on my own machine. After downloading the whole file, I run the unet.py. But it return: "FileNotFoundError: [Errno 2] No such file or directory: '../npydata/imgs_train.npy'"
Which one should execute at first?

Thanks a lot.

how to solve the problem in unet.py

When I have run the unet.py,Iget the result just like :AttributeError: 'ProgbarLogger' object has no attribute 'log_values.How can I solve this.

Cannot create the training data

Hello. I'm a very beginner about coding and deep learning.
Thank you for sharing the code and the instructions. They help me a lot.

I have a problem when try to run data.py to create the training data.
I already changed the parameters data_path,label_path,test_path and npy_path of init function of class dataProcess in file data.py to my own data directory. And when I run, it returns this error

File "C:/Users/HP/Desktop/unet-master/data.py", line 162, in create_train_data
midname = imgname[imgname.rindex("/")+1:]
ValueError: substring not found

I guess there's problem with reading the image file name, yet I have no idea how to deal with it.
My image name look something like this : 0071.tif 0072.tif 0073.tif 0074.tif 0081.tif 0082.tif 0091.tif 0131.tif 0132.tif 0151.tif and so on.
Please help. Thank you so much.

hello.i want to ask the order to run

1.use data augmentation
2.data.py
3.splitmerge.py
is it right or not? and i also want to ask the prepared data is only the augmented 30 images? and when and where to generate merge and .npy?in data.py?
thank you

关于data.py的数据问题

您好!您的代码对我帮助非常大!
只是在读取数据时,对路径有些疑问,不知我理解的是否正确:
Augmentation是用原始的train/image来做数据融合,存放到了新的aug_merge文件夹中,
create_train_data()使用的也是原始的30张图
但是imgdatas[i] = img这里img是一个(512,512,3)的矩阵,而imgdatas是一个(512,512,1)的矩阵,如何做赋值呢?
期待您的回复!

hellos! Some troubles in the test period

Hello! I'v met a trouble in the test period, when I run the trainUnet.ipynb step by step, something wrong when I run the "test model and save predicted results" part as follows:

ValueError Traceback (most recent call last)
in ()
2 model = unet()
3 model.load_weights("unet_membrane.hdf5")
----> 4 results = model.predict_generator(testGene,30,verbose=1)
5 saveResult("data/membrane/test",results)

~/anaconda3/envs/tf3/lib/python3.5/site-packages/keras/legacy/interfaces.py in wrapper(*args, **kwargs)
86 warnings.warn('Update your ' + object_name + 87 ' call to the Keras 2 API: ' + signature, stacklevel=2)
---> 88 return func(*args, **kwargs)
89 wrapper._legacy_support_signature = inspect.getargspec(func)
90 return wrapper

~/anaconda3/envs/tf3/lib/python3.5/site-packages/keras/engine/training.py in predict_generator(self, generator, steps, max_q_size, workers, pickle_safe, verbose)
2118 x = generator_output
2119
-> 2120 outs = self.predict_on_batch(x)
2121 if not isinstance(outs, list):
2122 outs = [outs]

~/anaconda3/envs/tf3/lib/python3.5/site-packages/keras/engine/training.py in predict_on_batch(self, x)
1703 ins = x
1704 self._make_predict_function()
-> 1705 outputs = self.predict_function(ins)
1706 if len(outputs) == 1:
1707 return outputs[0]

~/anaconda3/envs/tf3/lib/python3.5/site-packages/keras/backend/tensorflow_backend.py in call(self, inputs)
2267 updated = session.run(self.outputs + [self.updates_op],
2268 feed_dict=feed_dict,
-> 2269 **self.session_kwargs)
2270 return updated[:len(self.outputs)]
2271

~/anaconda3/envs/tf3/lib/python3.5/site-packages/tensorflow/python/client/session.py in run(self, fetches, feed_dict, options, run_metadata)
893 try:
894 result = self._run(None, fetches, feed_dict, options_ptr,
--> 895 run_metadata_ptr)
896 if run_metadata:
897 proto_data = tf_session.TF_GetBuffer(run_metadata_ptr)

~/anaconda3/envs/tf3/lib/python3.5/site-packages/tensorflow/python/client/session.py in _run(self, handle, fetches, feed_dict, options, run_metadata)
1102 'Cannot feed value of shape %r for Tensor %r, '
1103 'which has shape %r'
-> 1104 % (np_val.shape, subfeed_t.name, str(subfeed_t.get_shape())))
1105 if not self.graph.is_feedable(subfeed_t):
1106 raise ValueError('Tensor %s may not be fed.' % subfeed_t)

ValueError: Cannot feed value of shape () for Tensor 'input_6:0', which has shape '(?, 256, 256, 1)'

by the way, I use keras 2.0.5 and tensorflow1.5.0

How many images for data augmentation?

Hi,

Thanks for this implementation.

I know that the dataset is just 30 images, but can I know how many total images you used after performing data augmentation?

Thank you!
Chaitanya.

mask is empty

Hi, Thanks for the repo. Has been helpful in learning about NN.

i was trying to execute the net with LUNA 16 dataset. I loaded in the *.mhd files changes added them to an array to create an array of length 1536 X 512 X 512 X 1 and masks of same length. Passed them to a to net for training after subtracting with mean and dividing by std deviation as float 32 format numpy array. while training it is showing loss of 0.78+ and acc of 0.93+ after 10 epochs

after training while testing i get an out put image of only zeros. not mask is generated. can you please help me with this?

Question about labelling

Question about training data format. As far as I understood you augment data by using imgwrap tool. But how are the labels changed? How to label augmented training images?

question about data.py

Hi,
for dataProcess(object): I test it is Ok. But for splitMerge(self): when I read the train-volume.tif, it comes out nothing. the folders are empty. And when I run split_merge_tif.py, error occurs at line imgarr = imgdir.read_image(), which shows TypeError: unsupported operand type(s) for %: 'NoneType' and 'int'.
Could you please give any advice?

10历元训练精度达不到90,且预测图片内数组值全都一样?

你好,我看见你的名字是中文,就用中文说问题了
首先非常感谢你提供的代码,给了我很多启发。
但是,在实际运行这段代码时10个历元后精度只有78%左右,而且预测出的图片中数组值都是0.57。我只是把你数据生成的那段脚本调了一下,使得能够生成训练、标签和测试集,文件组织结构也和你代码里一样,训练图像和标签也是一一对应的,训练脚本完全没有动。但就是得不到你的精度和预测图像,是怎么回事呢?

这是什么错误

Using TensorFlow backend.
Traceback (most recent call last):
File "main.py", line 17, in
model = unet()
File "/home/chen/unet-master/model.py", line 36, in unet
merge6 = merge([drop4,up6], mode = 'concat', concat_axis = 3)
TypeError: 'module' object is not callable

关于多分类问题

感谢你的分享,也是看了你的博客而来。
想请教一个关于多分类的问题:
这个UNet如何做到多分类呢?像FCN那样,应该怎么修改呢?
感谢。

trainGenerator

hi,thanks for your work.
In the dataaugmentation,I just want to use your30 image to test.but it seems stucked in model.fit_generator,Since there are only 30 images,when I look the keras doc,it said ImageDataGenerator will always generate image in a dead loop,then,how can I set the loop number?or how can I train your code in a few epochs in a few minutes?according to the doc,it will always generating images in one epoch,set the data_gen_args = dict() in data.py does not work.Thanks if you can help me!

How to do color rgb segmentation with your trainGenerator ?

Hi, I'm trying to do a color segmentation (I have grayscale image, and their labeled image with colors).

I changed mask_color_mode to "rgb", and num_class to 3 (because I have 3 differents colors) in data.py, and I changed input_size from 256,256,1 to 256,256,3 in model.py, but I still have errors..

"expected input_1 to have shape (None,256,256,3) but got array with shape (2,256,256,1).
I rune the debugger and, mask.shape gave me : (2,256,256,3) and omg.shape gave me : (2,256,256,1)

Any idea ? Thanks in advance :)

run unet.py failed

I downloaded the repository and tried running unet.py, then I met the err
IOError: [Errno 2] No such file or directory: '../npydata/imgs_train.npy'

question about data.py

There is a function named splitTransform in the file of data.py. I read the code,but I cann't understand what does the function use for.I hope you could answer me and help me to solve the problem.

数据集问题

你好,我想问一下,如果我想要用这个网络来训练我自己的数据集,格式为jpeg
我应该如何处理,才能满足要求呢

hellos have a question

How to input a 2D image to keras?
I am using open cv2 to input four image then combine them into one,
now I want to do is input my new image into keras,how to do that?

Validation

Hi, it sounds no validation part in this code. Could you suggest how to add it? Thank you in advance!

hello ,there are some problems

thanks for the code. when i run the data.py, "glob" doesn't work, so i change it to "os.listdir" and i didn't use augmentation. i saved the data to npy file, but when i run the unet.py get_unet, it occured a typeError "init() takes at least 4 arguments (4 given)". i don't know how to solve it. could you give me some idea?

multi labeled data

Hi,
This model is suitable for binary segmentation. What if I want to do multi-label segmentation?

Best,

kernel_initializer problems

I use the model to segment my own medical images, but the ** kernel_initializer = 'he_normal'** makes the initialization vary so much in one training to other, and sometimes it leads to stuck the training. So in my experience is uncertain that works.
Someone had a similar problem?

Training with 10 epochs
image

The same configuration for training with 50 epochs, here the training is stuck
image

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.