Darknet- Segmentation fault (core dumped) - conv-neural-network

I'm trying to do object detection using YOLOv2 on my custom dataset(ubuntu 18.04). The following error ocurs:-
115: nan, nan avg loss, 0.001000 rate, 17.887053 seconds, 2760 images
Loaded: 0.000045 seconds
Very small path to the image:
Very small path to the image:
Region Avg IOU: nan, Class: -nan, Obj: nan, No Obj: nan, Avg Recall: 0.000000, count: 3
Region Avg IOU: nan, Class: -nan, Obj: nan, No Obj: nan, Avg Recall: 0.000000, count: 3
Region Avg IOU: nan, Class: -nan, Obj: nan, No Obj: nan, Avg Recall: 0.000000, count: 3
Region Avg IOU: nan, Class: -nan, Obj: nan, No Obj: nan, Avg Recall: 0.000000, count: 3
Region Avg IOU: nan, Class: -nan, Obj: nan, No Obj: nan, Avg Recall: 0.000000, count: 3
Region Avg IOU: nan, Class: -nan, Obj: nan, No Obj: nan, Avg Recall: 0.000000, count: 4
Region Avg IOU: nan, Class: -nan, Obj: nan, No Obj: nan, Avg Recall: 0.000000, count: 3
Region Avg IOU: nan, Class: -nan, Obj: nan, No Obj: nan, Avg Recall: 0.000000, count: 7
116: nan, nan avg loss, 0.001000 rate, 17.891146 seconds, 2784 images
Loaded: 0.000038 seconds
Very small path to the image:
Region Avg IOU: nan, Class: -nan, Obj: nan, No Obj: nan, Avg Recall: 0.000000, count: 3
Region Avg IOU: nan, Class: -nan, Obj: nan, No Obj: nan, Avg Recall: 0.000000, count: 3
Region Avg IOU: nan, Class: -nan, Obj: nan, No Obj: nan, Avg Recall: 0.000000, count: 3
Region Avg IOU: nan, Class: -nan, Obj: nan, No Obj: nan, Avg Recall: 0.000000, count: 3
Region Avg IOU: nan, Class: -nan, Obj: nan, No Obj: nan, Avg Recall: 0.000000, count: 3
Region Avg IOU: nan, Class: -nan, Obj: nan, No Obj: nan, Avg Recall: 0.000000, count: 5
Region Avg IOU: nan, Class: -nan, Obj: nan, No Obj: nan, Avg Recall: 0.000000, count: 6
Region Avg IOU: nan, Class: -nan, Obj: nan, No Obj: nan, Avg Recall: 0.000000, count: 3
117: nan, nan avg loss, 0.001000 rate, 17.822857 seconds, 2808 images
Loaded: 0.000036 seconds
Region Avg IOU: nan, Class: -nan, Obj: nan, No Obj: nan, Avg Recall: 0.000000, count: 3
Region Avg IOU: nan, Class: -nan, Obj: nan, No Obj: nan, Avg Recall: 0.000000, count: 3
Region Avg IOU: nan, Class: -nan, Obj: nan, No Obj: nan, Avg Recall: 0.000000, count: 3
Region Avg IOU: nan, Class: -nan, Obj: nan, No Obj: nan, Avg Recall: 0.000000, count: 4
Region Avg IOU: nan, Class: -nan, Obj: nan, No Obj: nan, Avg Recall: 0.000000, count: 3
Region Avg IOU: nan, Class: -nan, Obj: nan, No Obj: nan, Avg Recall: 0.000000, count: 6
Region Avg IOU: nan, Class: -nan, Obj: nan, No Obj: nan, Avg Recall: 0.000000, count: 3
Region Avg IOU: nan, Class: -nan, Obj: nan, No Obj: nan, Avg Recall: 0.000000, count: 8
118: nan, nan avg loss, 0.001000 rate, 17.878035 seconds, 2832 images
Loaded: 0.000035 seconds
Region Avg IOU: nan, Class: -nan, Obj: nan, No Obj: nan, Avg Recall: 0.000000, count: 6
Region Avg IOU: nan, Class: -nan, Obj: nan, No Obj: nan, Avg Recall: 0.000000, count: 7
Region Avg IOU: nan, Class: -nan, Obj: nan, No Obj: nan, Avg Recall: 0.000000, count: 5
Region Avg IOU: nan, Class: -nan, Obj: nan, No Obj: nan, Avg Recall: 0.000000, count: 31
Region Avg IOU: nan, Class: -nan, Obj: nan, No Obj: nan, Avg Recall: 0.000000, count: 3
Region Avg IOU: nan, Class: -nan, Obj: nan, No Obj: nan, Avg Recall: 0.000000, count: 10
Region Avg IOU: nan, Class: -nan, Obj: nan, No Obj: nan, Avg Recall: 0.000000, count: 3
Region Avg IOU: nan, Class: -nan, Obj: nan, No Obj: nan, Avg Recall: 0.000000, count: 16
119: nan, nan avg loss, 0.001000 rate, 17.851080 seconds, 2856 images
Loaded: 0.000033 seconds
Very small path to the image:
Region Avg IOU: nan, Class: -nan, Obj: nan, No Obj: nan, Avg Recall: 0.000000, count: 8
Region Avg IOU: nan, Class: -nan, Obj: nan, No Obj: nan, Avg Recall: 0.000000, count: 3
Region Avg IOU: nan, Class: -nan, Obj: nan, No Obj: nan, Avg Recall: 0.000000, count: 5
Region Avg IOU: nan, Class: -nan, Obj: nan, No Obj: nan, Avg Recall: 0.000000, count: 8
Region Avg IOU: nan, Class: -nan, Obj: nan, No Obj: nan, Avg Recall: 0.000000, count: 3
Region Avg IOU: nan, Class: -nan, Obj: nan, No Obj: nan, Avg Recall: 0.000000, count: 6
Region Avg IOU: nan, Class: -nan, Obj: nan, No Obj: nan, Avg Recall: 0.000000, count: 3
Region Avg IOU: nan, Class: -nan, Obj: nan, No Obj: nan, Avg Recall: 0.000000, count: 3
120: nan, nan avg loss, 0.001000 rate, 17.872121 seconds, 2880 images
Resizing
512 x 512
Loaded: 0.122598 seconds
Segmentation fault (core dumped)

Related

How to create box plots from columns of dicts in pandas

I have a dataframe where each row is a dictionary on which I'd like to use seaborn's horizontal box plot.
The x axis should be the float values for each 'dialog'
The y axis should show the 4 different models
There should be a plot for each parts of speech, meaning there should be a graph for 'INTJ', another for 'ADV' and so on.
I'm thinking I'll have to do a pd.melt first to restructure the data first so that the new columns would be 'dialog_num', 'model_type', and 'value' (automatic variable name after doing a melt, but basically the rows of dictionaries).
After that, perhaps break the 'value' variable so that each column is a part of speech ('ADV', 'INTJ', 'VERB', etc.) (this part seems tricky to me). Past this point...do a for loop on all of the columns and apply the horizontal boxplot?
import pandas as pd
pos =\
{'dialog_num': {0: 0, 1: 1, 2: 2},
'model1': {0: {'ADV': 0.072, 'INTJ': 0.03, 'PRON': 0.133, 'VERB': 0.109},
1: {'ADJ': 0.03, 'NOUN': 0.2, 'PRON': 0.13},
2: {'ADV': 0.083, 'PRON': 0.125, 'VERB': 0.0625}},
'model2': {0: {'ADJ': 0.1428, 'ADV': 0.1428, 'AUX': 0.1428, 'INTJ': 0.285},
1: {'ADJ': 0.1, 'DET': 0.1, 'NOUN': 0.1, 'PROPN': 0.1, 'VERB': 0.2},
2: {'CCONJ': 0.166, 'NOUN': 0.333, 'SPACE': 0.166, 'VERB': 0.3333}},
'model3': {0: {'ADJ': 0.06, 'CCONJ': 0.06, 'NOUN': 0.2, 'PRON': 0.266, 'SPACE': 0.066, 'VERB': 0.333},
1: {'AUX': 0.15, 'PRON': 0.25, 'PUNCT': 0.15, 'VERB': 0.15},
2: {'ADP': 0.125, 'PRON': 0.0625, 'PUNCT': 0.0625, 'VERB': 0.25}},
'model4': {0: {'ADJ': 0.25, 'ADV': 0.08, 'CCONJ': 0.083, 'PRON': 0.166},
1: {'AUX': 0.33, 'PRON': 0.2, 'VERB': 0.0667},
2: {'CCONJ': 0.125, 'NOUN': 0.125, 'PART': 0.125, 'PRON': 0.125, 'SPACE': 0.125, 'VERB': 0.375}}}
df = pd.DataFrame.from_dict(pos)
display(df)
dialog_num model1 model2 model3 model4
0 0 {'INTJ': 0.03, 'ADV': 0.072, 'PRON': 0.133, 'VERB': 0.109} {'INTJ': 0.285, 'AUX': 0.1428, 'ADV': 0.1428, 'ADJ': 0.1428} {'PRON': 0.266, 'VERB': 0.333, 'ADJ': 0.06, 'NOUN': 0.2, 'CCONJ': 0.06, 'SPACE': 0.066} {'PRON': 0.166, 'ADV': 0.08, 'ADJ': 0.25, 'CCONJ': 0.083}
1 1 {'PRON': 0.13, 'ADJ': 0.03, 'NOUN': 0.2} {'PROPN': 0.1, 'VERB': 0.2, 'DET': 0.1, 'ADJ': 0.1, 'NOUN': 0.1} {'PRON': 0.25, 'AUX': 0.15, 'VERB': 0.15, 'PUNCT': 0.15} {'PRON': 0.2, 'AUX': 0.33, 'VERB': 0.0667}
2 2 {'PRON': 0.125, 'ADV': 0.083, 'VERB': 0.0625} {'VERB': 0.3333, 'CCONJ': 0.166, 'NOUN': 0.333, 'SPACE': 0.166} {'PRON': 0.0625, 'VERB': 0.25, 'PUNCT': 0.0625, 'ADP': 0.125} {'PRON': 0.125, 'VERB': 0.375, 'PART': 0.125, 'CCONJ': 0.125, 'NOUN': 0.125, 'SPACE': 0.125}
sns.boxplot expects data to be supplied in a long form when specifying x= and y=.
In this case, based on the specifications of having each speech type as a separate plot, sns.catplot will be used because there is a col= parameter, which can be used to create separate plots for speech types.
As mentioned in the OP, use .melt to unpivot the wide dataframe.
.json_normalize can be used to convert the the 'value' column (dict type) into a flat table.
See Split / Explode a column of dictionaries into separate columns with pandas if there are issues with this step.
Join the flattened table (vals) to dfm with .join.
This works because vals and dfm have matching indices.
.melt the dataframe again.
Plot the box plot from the long form dataframe.
Tested in python 3.10, pandas 1.4.2, matplotlib 3.5.1, seaborn 0.11.2
import pandas as pd
import seaborn as sns
# load the dict into a dataframe
df = pd.DataFrame(pos)
# unpivot the dataframe
dfm = df.melt(id_vars='dialog_num', var_name='model')
# convert the 'value' column of dicts to a flat table
vals = pd.json_normalize(dfm['value'])
# combine vals to dfm, without the 'value' column
dfm = dfm.iloc[:, 0:-1].join(vals)
# unpivot the dataframe again
dfm = dfm.melt(id_vars=['dialog_num', 'model'])
plot all of the speech types together
p = sns.boxplot(data=dfm, x='value', y='model')
plot speech types separately
Most speech types have only a single value, or no values.
p = sns.catplot(kind='box', data=dfm, x='value', y='model', col='variable', col_wrap=4, height=4)
DataFrames at each step
1: dfm.head()
dialog_num model value
0 0 model1 {'INTJ': 0.03, 'ADV': 0.072, 'PRON': 0.133, 'VERB': 0.109}
1 1 model1 {'PRON': 0.13, 'ADJ': 0.03, 'NOUN': 0.2}
2 2 model1 {'PRON': 0.125, 'ADV': 0.083, 'VERB': 0.0625}
3 0 model2 {'INTJ': 0.285, 'AUX': 0.1428, 'ADV': 0.1428, 'ADJ': 0.1428}
4 1 model2 {'PROPN': 0.1, 'VERB': 0.2, 'DET': 0.1, 'ADJ': 0.1, 'NOUN': 0.1}
2: vals.head()
INTJ ADV PRON VERB ADJ NOUN AUX PROPN DET CCONJ SPACE PUNCT ADP PART
0 0.030 0.0720 0.133 0.1090 NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN
1 NaN NaN 0.130 NaN 0.0300 0.2 NaN NaN NaN NaN NaN NaN NaN NaN
2 NaN 0.0830 0.125 0.0625 NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN
3 0.285 0.1428 NaN NaN 0.1428 NaN 0.1428 NaN NaN NaN NaN NaN NaN NaN
4 NaN NaN NaN 0.2000 0.1000 0.1 NaN 0.1 0.1 NaN NaN NaN NaN NaN
3: dfm.head()
dialog_num model INTJ ADV PRON VERB ADJ NOUN AUX PROPN DET CCONJ SPACE PUNCT ADP PART
0 0 model1 0.030 0.0720 0.133 0.1090 NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN
1 1 model1 NaN NaN 0.130 NaN 0.0300 0.2 NaN NaN NaN NaN NaN NaN NaN NaN
2 2 model1 NaN 0.0830 0.125 0.0625 NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN
3 0 model2 0.285 0.1428 NaN NaN 0.1428 NaN 0.1428 NaN NaN NaN NaN NaN NaN NaN
4 1 model2 NaN NaN NaN 0.2000 0.1000 0.1 NaN 0.1 0.1 NaN NaN NaN NaN NaN
4: dfm.head()
dialog_num model variable value
0 0 model1 INTJ 0.030
1 1 model1 INTJ NaN
2 2 model1 INTJ NaN
3 0 model2 INTJ 0.285
4 1 model2 INTJ NaN

Combine different columns into a new column in a dataframe using pandas

I have a sample dataframe of a very huge dataframe as given below.
import pandas as pd
import numpy as np
NaN = np.nan
data = {'Start_x':['Tom', NaN, NaN, NaN,NaN],
'Start_y':[NaN, 'Nick', NaN, NaN, NaN],
'Start_z':[NaN, NaN, 'Alison', NaN, NaN],
'Start_a':[NaN, NaN, NaN, 'Mark',NaN],
'Start_b':[NaN, NaN, NaN, NaN, 'Oliver'],
'Sex': ['Male','Male','Female','Male','Male']}
df = pd.DataFrame(data)
df
I want the final result to look like the image given below. The 4 columns have to be merged to a single new column but the 'Sex' column should be as it is.
Any help is greatly appreciated. Thank you!
One option could be to backfill Start columns by rows and then take the first column:
df['New_Column'] = df.filter(like='Start').bfill(axis=1).iloc[:, 0]
df
Start_x Start_y Start_z Start_a Start_b Sex New_Column
0 Tom NaN NaN NaN NaN Male Tom
1 NaN Nick NaN NaN NaN Male Nick
2 NaN NaN Alison NaN NaN Female Alison
3 NaN NaN NaN Mark NaN Male Mark
4 NaN NaN NaN NaN Oliver Male Oliver

Converting exchange rates in pandas dataframe to GBP

I have a dataframe that looks like this. I'm trying to convert these stock prices to the corresponding exchange rates and output them into GBP.
df_test = pd.DataFrame({'Stock': ['AAPL', 'AAL', 'BBW', 'BBY'],
'Price': [123, 21, 15, 311],
'Currency': ['USD', 'CAD', 'EUR', 'GBP'],
'Date': ['2020-01-01', '2020-01-02', '2020-01-03', '2020-01-04'],
'USD': [1.6, 1.5, 1.55, 1.57],
'CAD': [1.7, 1.79, 1.75, 1.74],
'EUR': [1.17, 1.21, 1.18, 1.19],
'GBP': [1, 1, 1, 1]})
I want to multiply the stock price for each row so for example since AAPL is in USD I want it to be multiplied by 1.6 so it is converted into GBP, and the end output I am trying to get is something that would look like this.
df_end = pd.DataFrame({'Stock': ['AAPL', 'AAL', 'BBW', 'BBY'],
'Price': [123, 21, 15, 311],
'Currency': ['USD', 'CAD', 'EUR', 'GBP'],
'Date': ['2020-01-01', '2020-01-02', '2020-01-03', '2020-01-04'],
'USD': [1.6, 1.5, 1.55, 1.57],
'CAD': [1.7, 1.79, 1.75, 1.74],
'EUR': [1.17, 1.21, 1.18, 1.19],
'GBP': [1, 1, 1, 1],
'GBP value': [196.8, 37.59, 17.7, 311]})
Any help at all on this would be very much appreciated, thank you.
This used to be .lookup which is deprecated in Pandas 1.2.0. A way around this is get_indexer:
idx = df_test.columns.get_indexer(df_test['Currency'])
df_test['GBP val'] = df_test['Price'] * df_test.values[df.index, idx]
Output:
Stock Price Currency Date USD CAD EUR GBP GBP val
0 AAPL 123 USD 2020-01-01 1.60 1.70 1.17 1 196.8
1 AAL 21 CAD 2020-01-02 1.50 1.79 1.21 1 37.59
2 BBW 15 EUR 2020-01-03 1.55 1.75 1.18 1 17.7
3 BBY 311 GBP 2020-01-04 1.57 1.74 1.19 1 311
df_test["GBP value"] = df_test.apply(
lambda x: x["Price"] * x[x["Currency"]], axis=1
)
print(df_test)
Prints:
Stock Price Currency Date USD CAD EUR GBP GBP value
0 AAPL 123 USD 2020-01-01 1.60 1.70 1.17 1 196.80
1 AAL 21 CAD 2020-01-02 1.50 1.79 1.21 1 37.59
2 BBW 15 EUR 2020-01-03 1.55 1.75 1.18 1 17.70
3 BBY 311 GBP 2020-01-04 1.57 1.74 1.19 1 311.00

Element-wise division on sparse matrix python

I have a sparse matrix of size (n x m):
sparse_dtm = dok_matrix((num_documents, vocabulary_size), dtype=np.float32)
for doc_index, document in enumerate(data):
document_counter = Counter(document)
for word in set(document):
sparse_dtm[doc_index, word_to_index[word]] = document_counter[word]
Where:
num_documents = n
vocabulary_size = m
data = list of tokenized lists
Also, I have a list with length n:
sums = sparse_dtm.sum(1).tolist()
Now, I want to do an element-wise division in which each cell of row_i in sparse_dtm is divided by sums[i].
A naive approach, using the traditition Python element-wise division:
sparse_dtm / sums
Leads into the following error:
TypeError: unsupported operand type(s) for /: 'csr_matrix' and 'list'
How can I perform this element-wise division?
If I correctly understand, you need to divide each row by the sum of row, is that correct?
In this case, you'd need to reshape the sum
sparse_dtm / sparse_dtm.sum(1).reshape(-1, 1)
you can also do it with a pandas DataFrame, for example
row_num = 10
col_num = 5
sparse_dtm = np.ndarray((row_num, col_num), dtype=np.float32)
for row in range(row_num):
for col in range(col_num):
value = (row+1) * (col+2)
sparse_dtm[row, col] = value
df = pd.DataFrame(sparse_dtm)
print(df)
gives
0 1 2 3 4
0 2.0 3.0 4.0 5.0 6.0
1 4.0 6.0 8.0 10.0 12.0
2 6.0 9.0 12.0 15.0 18.0
3 8.0 12.0 16.0 20.0 24.0
4 10.0 15.0 20.0 25.0 30.0
5 12.0 18.0 24.0 30.0 36.0
6 14.0 21.0 28.0 35.0 42.0
7 16.0 24.0 32.0 40.0 48.0
8 18.0 27.0 36.0 45.0 54.0
9 20.0 30.0 40.0 50.0 60.0
and then divide each row for the sum of row
df / df.sum(axis=1).values.reshape(-1, 1)
that gives
0 1 2 3 4
0 0.1 0.15 0.2 0.25 0.3
1 0.1 0.15 0.2 0.25 0.3
2 0.1 0.15 0.2 0.25 0.3
3 0.1 0.15 0.2 0.25 0.3
4 0.1 0.15 0.2 0.25 0.3
5 0.1 0.15 0.2 0.25 0.3
6 0.1 0.15 0.2 0.25 0.3
7 0.1 0.15 0.2 0.25 0.3
8 0.1 0.15 0.2 0.25 0.3
9 0.1 0.15 0.2 0.25 0.3
In [189]: M = sparse.dok_matrix([[0,1,3,0],[0,0,2,0],[1,0,0,0]])
In [190]: M
Out[190]:
<3x4 sparse matrix of type '<class 'numpy.int64'>'
with 4 stored elements in Dictionary Of Keys format>
In [191]: M.A
Out[191]:
array([[0, 1, 3, 0],
[0, 0, 2, 0],
[1, 0, 0, 0]])
sum(1) produces a (3,1) np.matrix, which can be used directly in the division:
In [192]: M.sum(1)
Out[192]:
matrix([[4],
[2],
[1]])
In [193]: M/M.sum(1)
Out[193]:
matrix([[0. , 0.25, 0.75, 0. ],
[0. , 0. , 1. , 0. ],
[1. , 0. , 0. , 0. ]])
Note that the result is a dense np.matrix, not sparse.
This could give problems if the a row sum was 0, but with your construction that might not be the possible.
We can retain the sparse result by first converting the sums to sparse. I'm using the inverse because there isn't a sparse element-wise division (re. all those 0s):
In [205]: D=sparse.csr_matrix(1/M.sum(1))
In [206]: D
Out[206]:
<3x1 sparse matrix of type '<class 'numpy.float64'>'
with 3 stored elements in Compressed Sparse Row format>
In [207]: D.A
Out[207]:
array([[0.25],
[0.5 ],
[1. ]])
In [208]: D.multiply(M)
Out[208]:
<3x4 sparse matrix of type '<class 'numpy.float64'>'
with 4 stored elements in Compressed Sparse Row format>
In [209]: _.A
Out[209]:
array([[0. , 0.25, 0.75, 0. ],
[0. , 0. , 1. , 0. ],
[1. , 0. , 0. , 0. ]])
sklearn also has some added sparse matrix utilities
In [210]: from sklearn import preprocessing
In [211]: preprocessing.normalize(M, norm='l1', axis=1)
Out[211]:
<3x4 sparse matrix of type '<class 'numpy.float64'>'
with 4 stored elements in Compressed Sparse Row format>
In [212]: _.A
Out[212]:
array([[0. , 0.25, 0.75, 0. ],
[0. , 0. , 1. , 0. ],
[1. , 0. , 0. , 0. ]])

Tensorflow 2.0 : pb to restore model and perform inference

I am trying to modify the official pix2Pix Tensorflow 2.0 tutorial in order to save the generator's model and then be able to reload it and perform image generation (inference)
In order to do so, I have followed the example from 'Using the SavedModel format' tutorial This notebook code is executing fine, without any problem.
So basically I add at the end of the training loop, this code to save the generator's model to disk:
tf.saved_model.save(generator, checkpoint_dir + "/pix2pix/1/")
print("\nGenerator model saved in {}/pix2pix/1/".format(checkpoint_dir))
And then, in order to reload the model and do inference I use this code:
def generate_images2(model, test_input, tar, debug=True):
# Key name of the output layer in the model:
key_name = list(model.structured_outputs.keys())[0]
prediction = model(test_input)[key_name]
if debug:
print("Key name of the output layer in the model:", key_name)
print("\nprediction:\n", prediction)
plt.figure(figsize=(15,15))
display_list = [test_input[0], tar[0], prediction[0]]
title = ['Input Image', 'Ground Truth', 'Predicted Image']
for i in range(3):
plt.subplot(1, 3, i+1)
plt.title(title[i])
# getting the pixel values between [0, 1] to plot it.
plt.imshow(display_list[i] * 0.5 + 0.5)
plt.axis('off')
plt.show()
checkpoint_dir = './training_checkpoints'
loaded = tf.saved_model.load(checkpoint_dir + "/pix2pix/1/")
print("Load Model - signature keys:", list(loaded.signatures.keys()))
infer = loaded.signatures["serving_default"]
print("\nInference structure output:", infer.structured_outputs)
# Run the trained model on one exampel of the test dataset
for inp, tar in test_dataset.take(1):
generate_images2(infer, inp, tar, debug=True)
The code runs without error but the output tensor from the inference step (based on the reloaded model) contains only NaN values. Here is the inference's output:
Load Model - signature keys: ['serving_default']
Inference structure output: {'conv2d_transpose_8': TensorSpec(shape=(None, None, None, 3), dtype=tf.float32, name='conv2d_transpose_8')}
Key name of the output layer in the model: conv2d_transpose_8
prediction:
tf.Tensor(
[[[[nan nan nan]
[nan nan nan]
[nan nan nan]
...
[nan nan nan]
[nan nan nan]
[nan nan nan]]
[[nan nan nan]
[nan nan nan]
[nan nan nan]
...
[nan nan nan]
[nan nan nan]
[nan nan nan]]
[[nan nan nan]
[nan nan nan]
[nan nan nan]
...
[nan nan nan]
[nan nan nan]
[nan nan nan]]
...
[[nan nan nan]
[nan nan nan]
[nan nan nan]
...
[nan nan nan]
[nan nan nan]
[nan nan nan]]
[[nan nan nan]
[nan nan nan]
[nan nan nan]
...
[nan nan nan]
[nan nan nan]
[nan nan nan]]
[[nan nan nan]
[nan nan nan]
[nan nan nan]
...
[nan nan nan]
[nan nan nan]
[nan nan nan]]]], shape=(1, 256, 256, 3), dtype=float32)
Did I miss something or is there an issue with Tensorflow 2.0. Any idea or suggestion ?
Currently, I would suspect that the way the model is built, by assembling together several Keras sequential models (as building-blocks) might cause issue with the model save/restore features. (Similarly, Tensorboard is also not able to display properly the graph of the model: each of the buidling block appears disconnected from the others)
Note:
I am using Tensorflow GPU 2.0.0-rc1 with Python 3.6.8 (same issue with the rc0)
Here is a link to download the Jupyter notebook with the code - This notebook allows to reproduce the problem without having to use a Kubeflow cluster
Here is a link to download the Jupyter Notebook saved as a HTML page, including the execution output
The model in this notebook requires a GPU with at least 16GB of memory

Resources