StevenBanama / C3AE

C3AE implement
BSD 2-Clause "Simplified" License
87 stars 16 forks source link

I get "TypeError: 'NoneType' object is not callable" when train model #26

Open KhizarAziz opened 4 years ago

KhizarAziz commented 4 years ago

Hi, Thankyou for the code, When i run the code, everything works totally fine except this,

When i execute this line, models.fit(train_gen, steps_per_epoch=len(trainset) // batch_size, epochs=250, callbacks=callbacks, validation_data=validation_gen, validation_steps=len(testset) // batch_size * 3)

i get this error: Screen Shot 2020-10-31 at 5 16 05 AM

TypeError: 'NoneType' object is not callable`

Kindly help with this, or please guide to a direction where i can debug the code and solve the issue, i shall be highly thankful.

StevenBanama commented 4 years ago

@KhizarAziz check your tensorflow version with my requirements in the repos which may save your time

KhizarAziz commented 4 years ago

The problem was related to the age_data_generator. out2 = [candis.age.to_numpy(), np.array([two_point(x, category, interval) for x in candis.age.to_numpy()])] yield [imgs[:,0], imgs[:,1], imgs[:,2]], out2

I changed above code to: out2 = np.array([two_point(x, category, interval) for x in candis.age.to_numpy()]) yield [imgs[:,0], imgs[:,1], imgs[:,2]], out2

This fixed problem, but more questions arose here.....

  1. Why it fixed problem
  2. why were you return [age_numpy_array, two_point_representation_numpy]

i am confused, kindly help!!

StevenBanama commented 4 years ago

The problem was related to the age_data_generator. out2 = [candis.age.to_numpy(), np.array([two_point(x, category, interval) for x in candis.age.to_numpy()])] yield [imgs[:,0], imgs[:,1], imgs[:,2]], out2

I changed above code to: out2 = np.array([two_point(x, category, interval) for x in candis.age.to_numpy()]) yield [imgs[:,0], imgs[:,1], imgs[:,2]], out2

This fixed problem, but more questions arose here.....

  1. Why it fixed problem
  2. why were you return [age_numpy_array, two_point_representation_numpy]

i am confused, kindly help!!

@KhizarAziz age prediction in origin paper need two stage , meanwhile the age loss was composed by bucket loss and age MAE.The first stage gets age feature divided by age bucket and then compact these features to gen age prediction. "candis.age.to_numpy()" was add to calculate the loss of MAE.