cosmic-cortex / pytorch-unet Goto Github PK
View Code? Open in Web Editor NEW2D and 3D UNet implementation in PyTorch.
License: MIT License
2D and 3D UNet implementation in PyTorch.
License: MIT License
After the prediction code is run, only the output image is obtained. How to use these outputs to obtain the dice coefficient? Did you calculate the dice coefficient of the prediction set?How do you calculate that?
After the prediction code is run, only the output image is obtained. How to use these outputs to obtain the dice coefficient? Did you calculate the dice coefficient of the prediction set?How do you calculate that?
Hello, I got val_loss, f1 and train_loss by using my own data training volume networkIs it convenient to provide your training results?I want to make a reference.
Hello please kindly look at this error. Whenever I try to train my dataset by using train.py I keep getting this error. As I am new to pytorch a little guidance would be helpful.
RuntimeError: 1only batches of spatial targets supported (non-empty 3D tensors) but got targets of size: : [1, 512, 512, 3]
Thank you in advance.
File ".../unet/model.py", line 212, in fit_dataset **val_logs, **train_logs} UnboundLocalError: local variable 'val_logs' referenced before assignment
The val_dataset
argument to fit_dataset
is optional. However, if none is provided, val_logs
is not assigned. Anyway it is referenced, leading to this error.
Suggested fix: Add val_logs = {}
to the else
clause of if val_dataset is not None:
in fit_dataset
Hi,
Thank you for your project. It's helpful. I'm tried to launch your train.py script on a new dataset and i have encounter the following error
File "src/train.py", line 60, in
metric_list=metric_list, verbose=True)
File "/workspace/src/unet/model.py", line 186, in fit_dataset
train_logs = self.fit_epoch(dataset, n_batch=n_batch, shuffle=shuffle)
File "/workspace/src/unet/model.py", line 99, in fit_epoch
training_loss = self.loss(y_out, y_batch)
File "/usr/local/lib/python3.6/site-packages/torch/nn/modules/module.py", line 493, in call
result = self.forward(*input, **kwargs)
File "/workspace/src/unet/metrics.py", line 25, in forward
ignore_index=self.ignore_index)
File "/usr/local/lib/python3.6/site-packages/torch/nn/functional.py", line 2056, in cross_entropy
return nll_loss(log_softmax(input, 1), target, weight, None, ignore_index, None, reduction)
File "/usr/local/lib/python3.6/site-packages/torch/nn/functional.py", line 1873, in nll_loss
ret = torch._C._nn.nll_loss2d(input, target, weight, _Reduction.get_enum(reduction), ignore_index)
RuntimeError: Assertion `cur_target >= 0 && cur_target < n_classes' failed. at /pytorch/aten/src/THNN/generic/SpatialClassNLLCriterion.c:109
As i search in the internet for the cause, i find that maybe it's the dimensions of the output layer. The problem is thta i did not change anything and i used a similar dataset
Thank you for your help
Is this package public domain or is the license missing?
I ran:
python train.py --train_dataset images_folder/ --device 'cuda:0' --epochs 10 --save_freq 1 --save_model 1 --model_name round1 --crop 2560 --learning_rate 0.0001 --checkpoint_path checkpoint
Error output:
Traceback (most recent call last):
File "train.py", line 40, in <module>
val_dataset = ImageToImage2D(args.val_dataset, tf_val)
File "/unet/pytorch-UNet/unet/dataset.py", line 122, in __init__
self.input_path = os.path.join(dataset_path, 'images')
File "/anaconda3/lib/python3.7/posixpath.py", line 80, in join
a = os.fspath(a)
TypeError: expected str, bytes or os.PathLike object, not NoneType
The diagram says images_folder, but there is none.
The instructions repeat itself for diff flag.
I wish there was standards in docs, you can reduce the amount of stuff in readme, with a simple step by step to recreate so ppl can just take it from there.
I have a new question. In my training results, the value of val_loss is very unstable, but the result of train_loss is good. What is the reason for this?
0.121626744
0.064643869
1.067177767
1.446711094
1.281244414
0.085074004
0.033228467
0.07067455
0.057629818
0.058747965
1.917625544
0.041074573
0.15646584
1.15546266
1.469133962
0.040493928
1.874986998
1.004034303
0.048311408
0.100535154
1.64835466
0.054501295
0.055335191
0.10456412
0.276266118
0.068388779
0.715268846
0.098956134
2.583597354
0.538678182
1.748115192
0.060186028
1.108167116
0.309113808
0.101157197
0.124394018
0.066762745
0.055764281
0.460467963
2.378881313
0.066589679
0.471164338
0.078409711
0.065184287
0.086847927
0.101323177
0.069627192
1.949108887
0.56550861
1.750528685
1.873376575
1.489622217
0.994260068
0.066217561
0.065698464
0.072816557
0.073953711
0.071316366
0.421468448
0.85330223
0.076412463
1.056728009
0.092980409
0.074839294
0.63967285
1.866399809
1.322311701
0.07251732
0.076650151
0.075991224
0.592627899
0.178139341
0.874911083
0.086961034
2.873830932
0.082318357
0.086678351
0.09311628
0.110618592
0.797192226
0.08203448
0.144572049
0.083447114
0.103286757
0.089605071
0.136912736
0.149895869
0.079707029
0.091769812
0.987303428
0.093305247
0.089239203
1.865140941
1.418952992
0.174026518
0.094368358
0.095077354
0.629811309
0.090620203
1.349854706
0.230814192
0.028987918
0.024291774
0.017069094
0.014445363
0.013398573
0.017434838
0.010788895
0.010943851
0.010186778
0.008584953
0.01008794
0.008166692
0.00812426
0.007191894
0.006891105
0.007163724
0.006250243
0.007437692
0.005759141
0.005480012
0.007539251
0.005302504
0.005195955
0.005868624
0.004928016
0.004689556
0.00476825
0.004551805
0.004410871
0.004312812
0.005318373
0.003946777
0.00389254
0.004088193
0.004916692
0.003619704
0.003698593
0.003596091
0.003551835
0.003599238
0.003506489
0.003349912
0.004076907
0.003196912
0.003090051
0.003097881
0.003223821
0.003074504
0.003073007
0.002930183
0.002931052
0.002878063
0.002818113
0.004682063
0.002902587
0.00261943
0.002597745
0.002628764
0.002631262
0.003391225
0.002469422
0.002454039
0.002499085
0.002512494
0.00248172
0.002464812
0.002398441
0.002394155
0.002346173
0.002301199
0.002282861
0.002268845
0.002215712
0.002189308
0.002250406
0.002511505
0.002021703
0.00206177
0.002084404
0.002078039
0.00203906
0.002020018
0.001995647
0.001981924
0.001943689
0.001929661
0.001958759
0.001993959
0.001822729
0.001834546
0.001916094
0.001810232
0.001773823
0.001764436
0.001750559
0.001739222
0.002303985
0.001640475
0.001577288
What are middle_channels?
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.