Some problems occurred in utils.py when reproducing AttnGAN - python-imaging-library

When I tried to reproduce the AttnGAN code, there was a problem with training DAMSM. The code shows
File "/home/ManiGAN-master/code/miscc/utils.py", line 145, in build_super_images
PIL_att = Image.fromarray(np.uint8(one_map))
File "/home/anaconda3/envs/pt/lib/python3.7/site-packages/PIL/Image.py", line 2463, in fromarray
raise TypeError("Cannot handle this data type")
TypeError: Cannot handle this data type
I tried a lot of PIL versions, but did anyone encounter the same problem? How to solve it? Thanks a lot!

Related

difficulty exporting visuals in Jupyter

I am working on task and have completed it but having issues exporting my charts. I have tried many different variations and I am getting all kinds of errors.
My code for the bar chart is
orders_products_merged['order_day_of_week'].value_counts().plot.bar()
some codes i have tried that haven't worked are
orders_products_merged.plot.figure.savefig('order_day_of_weeky.png')
orders_products_merged['order_day_of_week.png'].plot.bar(bins=500.get_figure().savefig)
some errors i have gotten are
AttributeError: 'PlotAccessor' object has no attribute 'figure'
SyntaxError: invalid syntax
and many more. Any help would be appreciated.
Thanks

VS Code Studio Error: assert batch_size <= self._num_examples AssertionError

Help me solve this error, I am trying to fit the train data, I don't understand these errors. Please help if anyone knows them.
Here is the link
https://github.com/thiagortk/Road-Surface-Classification/blob/master/Road%20Surface%20Classification/train.py

An error in executing a .gap file in GAP software

I am trying to load two .gap files but I receive the following error message. What could be the reason?
Thanks a lot in advance.
Error in executing .gap files
I have already read F1.gap file. I don't understand why it says F1 must be readable to load the F2.gap file.
Please help me to solve this problem.

Error when loading .mat file with scipy.io (ValueError: Mat 4 mopt wrong format)

I'm currently trying to load a .mat file in python using scipy and the following bit of code:
from scipy import io as sio
data= "file.mat"
output= sio.loadmat(data)
However when running the command I get the error:
ValueError: Mat 4 mopt wrong format, byteswapping problem?
What does this error message mean? Is there an issue with the file I'm trying to load?
I'm quite the novice when it comes to programming so any suggestions would be greatly appreciated : ) If there is a better way to load .mat files in python I'm open to hearing those too. Thanks in advance!
I've never seen this error before, but it is produced by line 113 in scipy/scipy/io/matlab/mio4.py
def read_header(self):
''' Read and return header for variable '''
data = read_dtype(self.mat_stream, self.dtypes['header'])
name = self.mat_stream.read(int(data['namlen'])).strip(b'\x00')
if data['mopt'] < 0 or data['mopt'] > 5000:
raise ValueError('Mat 4 mopt wrong format, byteswapping problem?')
...
Normally loadmat is the right file loader, at least among the supported types:
v4 (Level 1.0), v6 and v7 to 7.2 matfiles are supported.
Do you know anything about how this file was saved in MATLAB? Any format specifications such as these?

Error using matlab.io.fits.openFile - cannot open FITS files

I am running a code that uses the fitsread function to open my fits movies and analyse them. It was working perfectly fine until about a week ago, when, without me doing anything, it started giving the following error whenever I try to run it:
Error using matlab.io.fits.openFile (line 48)
Unable to open file. File might be corrupt or filename might have unsupported
characters.
Error in fitsread>read_image_hdu (line 412)
fptr = fits.openFile(info.Filename);
Error in fitsread (line 125)
data = read_image_hdu(info,1,raw,pixelRegion);
I have tried manually checking the properties of such files using the fitsinfo function and nothing was wrong with the files themselves. I have also tried to re-set the default MATLAB path, delete them from the working folder and re-download them from a central University server where they were originally stored upon acquisition on a microscope, but it didn't help either. A collaborator has tried running the same code on his machine and it works well. I get this same error on both MATLAB versions R2011b and R2015b. It originally used to work on R2011b with the same files.
Thanks in advance to whoever will be able to help!