This is because of the type used, I just had this problem and solved it by specifying a dtype for my dataframe. In your similarities.info() seaborn wants to see DType:'float64' or another number type.
similarities = pd.DataFrame(..., dtype="float")
Heatmap fails with Matplotlib pgf backend
python - Seaborn Heatmap correlation won't fit annotation digits - Stack Overflow
python - AttributeError: 'NoneType' object has no attribute 'reshape' - Stack Overflow
python - Error while drawing animation of seaborn heatmap for 3D volume - Stack Overflow
As pointed in the comments, using square=False with figsize=(30, 15) fixed the problem.
The issue is that your labels are taking too much space of your jupyter max width. You probably have 2 options, the first one is editing jupyter width according to this answer:
https://stackoverflow.com/a/34058270/2970272
The second one would be lowering how much you're using the plot space, by trimming your labels, lowering the font, removing the colorbar and such. From the code bellow check all the "## HERE" comments to easily find what I've changed.
import seaborn as sns
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
# Generate a dummy df
df = pd.DataFrame(np.random.rand(44,44))
label_lens = [16, 16, 16, 16, 16, 16, 16, 16, 20, 11,
9, 10, 10, 16, 16, 16, 16, 12, 45, 10, 10,
10, 10, 10, 10, 10, 10, 12, 12, 50, 50, 50,
50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50]
#label_lens= [5]*len(label_lens)
col_labels = []
for label_len in label_lens:
col_labels.append(f"{'X'*label_len}"[:10]) ## HERE -- max char limit
df.columns = col_labels
# Build correlation matrix df
correlation_matrix = df.corr()
# Get Diagonal Mask. Square matrix is not relevant.
mask = np.triu(np.ones_like(correlation_matrix, dtype=bool))
# Set up the matplotlib figure
f, ax = plt.subplots(figsize=(30, 20)) ## here increased figsize
## HERE - max tick font size
ax.tick_params(axis='both', labelsize=8)
# Draw the heatmap with the mask and correct aspect ratio
sns_plot = sns.heatmap(correlation_matrix,
mask=mask,
annot=True,
fmt='.2f',
square=True,
cbar=False) ## HERE removed colorbar
f.set_tight_layout(True)
## HERE - rotating ticks to give more space
plt.setp(ax.yaxis.get_majorticklabels(), rotation=-45)
plt.setp(ax.xaxis.get_majorticklabels(), rotation=-45)
plt.show()
#f.savefig("my_corr_matrix.pdf")
It is possible to return a value of type None, check the type of X_train in the following lines:
CopyX_train = X_train.resize((32, 32))
type(X_train)
X_train = X_train.reshape((len(X_train), 3, 32, 32))
type(X_train)
only the type of array can use reshape() and it can not change the number of the data your array contains. Maybe you can try something like this:
Copyimport numpy as np
from PIL import Image
import matplotlib as plt
x_train = Image.open('skyscraper.jpg')
x_train = x_train.resize((32,32))
x_train = np.array(x_train)
x_train = x_train.reshape((3,32,32))
print(x_train)
I used the ControlNet extension & the Realistic Vision checkpoint, and it keeps giving me this error, "AttributeError: 'NoneType' object has no attribute 'shape'" whenever I try to generate a image. Even not using them, I still get this error.
What is the issue and how can I fix it?
Edit: it turns out when trying to use ControlNet, I was matching one of the preprocessors with the wrong models.

