Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

how to train rgb images #30

Closed
aagainbeyond2 opened this issue Feb 1, 2019 · 5 comments
Closed

how to train rgb images #30

aagainbeyond2 opened this issue Feb 1, 2019 · 5 comments

Comments

@aagainbeyond2
Copy link

how to train rgb images?

@aagainbeyond2
Copy link
Author

line 85 in main.py, you set nc = 1, is that means you train model with gray images?

@Canjie-Luo
Copy link
Owner

Yes, change nc = 1 to nc = 3 and use .convert('RGB') in line 49 in tools/dataset.py.

@aagainbeyond2
Copy link
Author

root@afaec42d144c:/workspace/MORAN_v2# sh train_MORAN.sh
Namespace(BidirDecoder=True, MORAN='', adadelta=True, adam=False, alphabet='0:1:2:3:4:5:6:7:8:9:$', batchSize=64, beta1=0.5, cuda=True, displayInterval=100, experiment='output/', imgH=96, imgW=200, lr=0.004, n_test_disp=10, ngpu=1, nh=256, niter=10, saveInterval=40000, sep=':', sgd=False, targetH=32, targetW=100, train_cvpr='price_no_decimal_lmdb', train_nips='price_no_decimal_lmdb', valInterval=1000, valroot='eval_price_no_decimal_lmdb', workers=2)
mkdir: cannot create directory 'output/': File exists
Random Seed: 8625
Start val
Traceback (most recent call last):
File "main.py", line 240, in
acc_tmp = val(test_dataset, criterion)
File "main.py", line 150, in val
data = val_iter.next()
File "/opt/conda/lib/python3.6/site-packages/torch/utils/data/dataloader.py", line 281, in next
return self._process_next_batch(batch)
File "/opt/conda/lib/python3.6/site-packages/torch/utils/data/dataloader.py", line 301, in _process_next_batch
raise batch.exc_type(batch.exc_msg)
ValueError: Traceback (most recent call last):
File "/opt/conda/lib/python3.6/site-packages/torch/utils/data/dataloader.py", line 55, in _worker_loop
samples = collate_fn([dataset[i] for i in batch_indices])
File "/opt/conda/lib/python3.6/site-packages/torch/utils/data/dataloader.py", line 55, in
samples = collate_fn([dataset[i] for i in batch_indices])
File "/workspace/MORAN_v2/tools/dataset.py", line 56, in getitem
label_key = 'label-%09d' % index
File "/workspace/MORAN_v2/tools/dataset.py", line 56, in getitem
label_key = 'label-%09d' % index
File "/opt/conda/lib/python3.6/bdb.py", line 51, in trace_dispatch
return self.dispatch_line(frame)
File "/opt/conda/lib/python3.6/site-packages/pudb/debugger.py", line 187, in dispatch_line
self.user_line(frame)
File "/opt/conda/lib/python3.6/site-packages/pudb/debugger.py", line 408, in user_line
self.interaction(frame)
File "/opt/conda/lib/python3.6/site-packages/pudb/debugger.py", line 376, in interaction
show_exc_dialog=show_exc_dialog)
File "/opt/conda/lib/python3.6/site-packages/pudb/debugger.py", line 2116, in call_with_ui
self.show()
File "/opt/conda/lib/python3.6/site-packages/pudb/debugger.py", line 2107, in show
self.screen.start()
File "/opt/conda/lib/python3.6/site-packages/urwid/display_common.py", line 751, in start
self._start(*args, **kwargs)
File "/opt/conda/lib/python3.6/site-packages/urwid/raw_display.py", line 219, in _start
fd = self._term_input_file.fileno()
ValueError: I/O operation on closed file

@aagainbeyond2
Copy link
Author

I set nc = 3 and convert RGB, but this error occur. Please help me

@Canjie-Luo
Copy link
Owner

It works on my computer. Maybe something wrong in your datasets, I guess. Please check your datasets and keep your code up-to-date.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants