Closed harisharvind closed 4 years ago
Tried the same code on a different machine and am getting similar error
ValueError: not enough values to unpack (expected 3, got 2)
I have tested it and it's working on my end.
The error means that image_loader only returns 2 variables instead of 3.
Could you print and post here the values of these 2 returned these 2 returned variables?
Sorry, I'm new to programming. How do I do this?
Change this
for content_batch, _, path in image_loader:
to
for value1, value2 in image_loader:
print(value1)
print(value2)
Then send here a picture of the console output
I got something like this
[tensor([[[[146., 147., 149., ..., 2., 2., 2.], [146., 147., 149., ..., 2., 2., 2.], [146., 147., 150., ..., 2., 2., 2.], ..., [159., 159., 160., ..., 3., 3., 3.], [159., 159., 160., ..., 3., 3., 3.], [159., 159., 160., ..., 3., 3., 2.]],
[[147., 148., 150., ..., 2., 2., 2.],
[147., 148., 150., ..., 2., 2., 2.],
[147., 148., 151., ..., 2., 2., 2.],
...,
[178., 178., 179., ..., 5., 5., 5.],
[178., 178., 179., ..., 5., 5., 5.],
[178., 178., 179., ..., 5., 5., 4.]],
[[139., 140., 142., ..., 0., 0., 0.],
[139., 140., 142., ..., 0., 0., 0.],
[139., 140., 143., ..., 0., 0., 0.],
...,
[184., 184., 185., ..., 4., 4., 4.],
[184., 184., 185., ..., 4., 4., 4.],
[184., 184., 185., ..., 4., 4., 3.]]],
[[[146., 147., 150., ..., 2., 2., 2.],
[146., 147., 150., ..., 2., 2., 2.],
[146., 147., 151., ..., 2., 2., 2.],
...,
[162., 161., 161., ..., 0., 0., 0.],
[162., 161., 159., ..., 0., 0., 0.],
[162., 160., 159., ..., 0., 0., 0.]],
[[147., 148., 151., ..., 2., 2., 2.],
[147., 148., 151., ..., 2., 2., 2.],
[147., 148., 152., ..., 2., 2., 2.],
...,
[181., 180., 180., ..., 0., 0., 0.],
[181., 180., 178., ..., 0., 0., 0.],
[181., 179., 178., ..., 0., 0., 0.]],
[[139., 140., 143., ..., 0., 0., 0.],
[139., 140., 143., ..., 0., 0., 0.],
[139., 140., 144., ..., 0., 0., 0.],
...,
[187., 186., 186., ..., 0., 0., 0.],
[187., 186., 184., ..., 0., 0., 0.],
[187., 185., 184., ..., 0., 0., 0.]]],
[[[171., 171., 172., ..., 26., 44., 47.],
[170., 169., 170., ..., 48., 54., 54.],
[167., 167., 168., ..., 54., 58., 62.],
...,
[191., 193., 195., ..., 80., 80., 81.],
[198., 195., 193., ..., 75., 76., 77.],
[201., 196., 197., ..., 72., 73., 75.]],
[[171., 171., 172., ..., 22., 40., 43.],
[170., 169., 170., ..., 44., 50., 50.],
[166., 166., 167., ..., 53., 54., 58.],
...,
[ 10., 12., 14., ..., 76., 76., 77.],
[ 17., 14., 12., ..., 71., 72., 73.],
[ 20., 15., 16., ..., 68., 69., 71.]],
[[171., 171., 172., ..., 21., 39., 44.],
[170., 169., 170., ..., 43., 51., 51.],
[164., 164., 165., ..., 51., 55., 59.],
...,
[ 79., 81., 83., ..., 77., 77., 78.],
[ 84., 83., 81., ..., 72., 73., 74.],
[ 87., 82., 83., ..., 69., 70., 72.]]],
...,
[[[158., 158., 157., ..., 4., 5., 5.],
[157., 157., 155., ..., 4., 4., 5.],
[158., 157., 155., ..., 4., 4., 4.],
...,
[165., 164., 163., ..., 0., 0., 1.],
[164., 163., 163., ..., 0., 0., 1.],
[165., 164., 164., ..., 0., 0., 1.]],
[[159., 159., 158., ..., 5., 6., 6.],
[158., 158., 156., ..., 5., 5., 6.],
[159., 158., 156., ..., 5., 5., 5.],
...,
[184., 183., 182., ..., 0., 0., 1.],
[183., 182., 182., ..., 0., 0., 1.],
[184., 183., 183., ..., 0., 0., 1.]],
[[151., 151., 150., ..., 0., 1., 1.],
[150., 150., 148., ..., 0., 0., 1.],
[151., 150., 148., ..., 0., 0., 0.],
...,
[191., 190., 189., ..., 0., 0., 1.],
[190., 189., 189., ..., 0., 0., 1.],
[191., 190., 190., ..., 0., 0., 1.]]],
[[[162., 161., 158., ..., 4., 5., 5.],
[162., 161., 158., ..., 4., 5., 5.],
[160., 159., 157., ..., 4., 4., 5.],
...,
[173., 172., 171., ..., 9., 9., 8.],
[173., 172., 172., ..., 9., 9., 8.],
[174., 173., 172., ..., 9., 9., 7.]],
[[158., 157., 154., ..., 3., 4., 4.],
[158., 157., 154., ..., 3., 4., 4.],
[156., 155., 153., ..., 3., 3., 4.],
...,
[184., 183., 182., ..., 9., 9., 8.],
[184., 183., 183., ..., 9., 9., 8.],
[185., 184., 183., ..., 9., 9., 7.]],
[[147., 146., 143., ..., 1., 2., 2.],
[147., 146., 143., ..., 1., 2., 2.],
[145., 144., 142., ..., 1., 1., 2.],
...,
[190., 189., 188., ..., 9., 9., 8.],
[190., 189., 189., ..., 9., 9., 8.],
[191., 190., 189., ..., 9., 9., 7.]]],
[[[162., 159., 156., ..., 5., 5., 5.],
[159., 157., 155., ..., 5., 5., 5.],
[156., 156., 155., ..., 4., 4., 4.],
...,
[173., 171., 170., ..., 5., 0., 0.],
[174., 172., 171., ..., 5., 1., 0.],
[175., 172., 171., ..., 5., 1., 1.]],
[[158., 155., 152., ..., 4., 4., 4.],
[155., 153., 151., ..., 4., 4., 4.],
[152., 152., 151., ..., 3., 3., 3.],
...,
[184., 182., 181., ..., 5., 0., 0.],
[185., 183., 182., ..., 5., 1., 0.],
[186., 183., 182., ..., 5., 1., 1.]],
[[147., 144., 141., ..., 2., 2., 2.],
[144., 142., 140., ..., 2., 2., 2.],
[141., 141., 140., ..., 1., 1., 1.],
...,
[188., 186., 185., ..., 5., 0., 0.],
[189., 187., 186., ..., 5., 1., 0.],
[190., 187., 186., ..., 5., 1., 1.]]]]), tensor([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0])]
('frames/content_folder\frame6958.jpg', 'frames/content_folder\frame6959.jpg', 'frames/content_folder\frame696.jpg', 'frames/content_folder\frame6960.jpg', 'frames/content_folder\frame6961.jpg', 'frames/content_folder\frame6962.jpg', 'frames/content_folder\frame6963.jpg', 'frames/content_folder\frame6964.jpg', 'frames/content_folder\frame6965.jpg', 'frames/content_folder\frame6966.jpg', 'frames/content_folder\frame6967.jpg', 'frames/content_folder\frame6968.jpg', 'frames/content_folder\frame6969.jpg', 'frames/content_folder\frame697.jpg', 'frames/content_folder\frame6970.jpg', 'frames/content_folder\frame6971.jpg', 'frames/content_folder\frame6972.jpg', 'frames/content_folder\frame6973.jpg', 'frames/content_folder\frame6974.jpg', 'frames/content_folder\frame6975.jpg') [tensor([[[[164., 162., 160., ..., 5., 5., 5.], [162., 161., 160., ..., 5., 5., 5.], [160., 160., 159., ..., 4., 4., 4.], ..., [173., 171., 170., ..., 0., 0., 0.], [174., 172., 171., ..., 0., 0., 0.], [175., 172., 171., ..., 0., 0., 0.]],
I'm getting the same error when I try to run the project on google colab too
It's not clear which of the two are value1 and value2. Could you try printing a string between them? like
for value1, value2 in image_loader:
print(value1)
print("=========================")
print(value2)
break
I think instead of
for content_batch, _, path in image_loader:
you can do
for content, path in image_loader:
content_batch =content[0]
Thank you so much.
for content, path in image_loader:
content_batch =content[0]
solved it
While trying to run video.py, I get the following error. What am I doing wrong?
Traceback (most recent call last): File "video.py", line 84, in
video_transfer(VIDEO_NAME, STYLE_PATH)
File "video.py", line 34, in video_transfer
stylize_folder(style_path, FRAME_SAVE_PATH, STYLE_FRAME_SAVE_PATH, batch_size=BATCH_SIZE)
File "/home/user/fast-neural-style-pytorch/stylize.py", line 115, in stylize_folder
ValueError: need more than 2 values to unpack