Closed tomudo closed 5 years ago
Can you attach the full output from the beginning? It appears to me that you are running the wrong command but I can’t be sure from only the error message e.g. seems you run a image classification model (resnet) whereas it should be semantic segmentation.
Here is my command and full output.
(base) nott@ubuntu:~/AI/ancient/DeepDIVA$ conda activate deepdiva
(deepdiva) nott@ubuntu:~/AI/ancient/DeepDIVA$ python template/RunMe.py --runner-class semantic_segmentation --dataset-folder /home/nott/AI/ancient/Text-Line-Segmentation-Method-for-Medieval-Manuscripts/src/data/img-CB55/img/ --ignoregit --no-cuda -j 1 --model-name resnet18
Please enter an experiment name:
[2019-10-04 10:03:39] [ INFO] --- Setup logging. Log file: ./output/img/model_name=resnet18/no_cuda=True/workers=1/04-10-19-10h-03m-39s/logs.txt (setup.py:601)
[2019-10-04 10:03:39] [ INFO] --- Arguments saved to: ./output/img/model_name=resnet18/no_cuda=True/workers=1/04-10-19-10h-03m-39s/args.txt (setup.py:604)
[2019-10-04 10:03:47] [ INFO] --- Initialize Tensorboard SummaryWriter (setup.py:613)
[2019-10-04 10:03:48] [ WARNING] --- Git status is ignored! (RunMe.py:208)
[2019-10-04 10:03:48] [ INFO] --- Randomly chosen seed is: 3169582089 (setup.py:698)
[2019-10-04 10:03:48] [ INFO] --- Loading img from:/home/nott/AI/ancient/Text-Line-Segmentation-Method-for-Medieval-Manuscripts/src/data/img-CB55/img/ (setup.py:45)
[2019-10-04 10:04:12] [ INFO] --- Setting up model resnet18 (setup.py:86)
[2019-10-04 10:04:15] [ INFO] --- Loading weights for data balancing (setup.py:253)
[2019-10-04 10:04:15] [ INFO] --- Begin training (image_classification.py:139)
0%| | 0/8 [00:00<?, ?batch/s][2019-10-04 10:04:58] [ ERROR] --- Unhandled error: RuntimeError('Given input size: (512x4x4). Calculated output size: (512x-2x-2). Output size is too small at /opt/conda/conda-bld/pytorch_1549636813070/work/aten/src/THNN/generic/SpatialAveragePooling.c:48') (RunMe.py:264)
[2019-10-04 10:04:58] [ ERROR] --- Traceback (most recent call last):
File "template/RunMe.py", line 257, in _execute
**args.__dict__)
File "/home/nott/AI/ancient/DeepDIVA/template/runner/image_classification/image_classification.py", line 47, in single_run
**kwargs)
File "/home/nott/AI/ancient/DeepDIVA/template/runner/image_classification/image_classification.py", line 144, in train_routine
val_value[-1] = cls._validate(epoch=-1, **kwargs)
File "/home/nott/AI/ancient/DeepDIVA/template/runner/semantic_segmentation/semantic_segmentation.py", line 40, in _validate
return evaluate.validate(class_encodings=cls.class_encoding, **kwargs)
File "/home/nott/AI/ancient/DeepDIVA/template/runner/semantic_segmentation/evaluate.py", line 78, in validate
output = model(input)
File "/home/nott/anaconda3/envs/deepdiva/lib/python3.7/site-packages/torch/nn/modules/module.py", line 489, in __call__
result = self.forward(*input, **kwargs)
File "/home/nott/AI/ancient/DeepDIVA/models/image_classification/ResNet.py", line 156, in forward
x = self.avgpool(x)
File "/home/nott/anaconda3/envs/deepdiva/lib/python3.7/site-packages/torch/nn/modules/module.py", line 489, in __call__
result = self.forward(*input, **kwargs)
File "/home/nott/anaconda3/envs/deepdiva/lib/python3.7/site-packages/torch/nn/modules/pooling.py", line 565, in forward
self.padding, self.ceil_mode, self.count_include_pad)
RuntimeError: Given input size: (512x4x4). Calculated output size: (512x-2x-2). Output size is too small at /opt/conda/conda-bld/pytorch_1549636813070/work/aten/src/THNN/generic/SpatialAveragePooling.c:48
(RunMe.py:265)
[2019-10-04 10:04:58] [ ERROR] --- Execution finished with errors :( (RunMe.py:266)
All done! (Log files at ./output/img/model_name=resnet18/no_cuda=True/workers=1/04-10-19-10h-03m-39s )
Thank you for you help.
You are using a resnet18 which is not a suitable model for semantic segmentation. You should use the models designed for that task instead (tiramisu, unet, ... )
I use unet model that could train without problem. Thank you very much.
from: https://diva-dia.github.io/DeepDIVAweb/articles/use-image-segmentation/
I run code by using resnet18 model.
python RunMe.py --dataset-folder /path/to/dataset --runner-class semantic_segmentation --no-cuda --ignoregit --model-name resnet18
.For dataset, I use Diva-HisDB CB55 images
data images from https://diuf.unifr.ch/main/hisdoc/sites/diuf.unifr.ch.main.hisdoc/files/uploads/diva-hisdb/hisdoc/img-CB55.zip
gt images from https://diuf.unifr.ch/main/hisdoc/sites/diuf.unifr.ch.main.hisdoc/files/uploads/diva-hisdb/hisdoc/pixel-level-gt-CB55.zip
I arranged data to
Trainning error is
I use latest git deepdiva and release version but still have this error