anish-lakkapragada / MakeCNN

MakeCNN is how we make sure everybody can benefit from ML.
BSD 3-Clause "New" or "Revised" License
5 stars 0 forks source link

NameError: name 'num_classes' is not defined #1

Open gbrsouza opened 2 years ago

gbrsouza commented 2 years ago

I'm having the following problem when trying to train a MCNN model

Found 1393 images belonging to 3 classes.
Found 597 images belonging to 3 classes.
2022-06-09 23:58:59.519369: I tensorflow/core/platform/cpu_feature_guard.cc:193] This TensorFlow binary is optimized with oneAPI Deep Neural Network Library (oneDNN) to use the following CPU instructions in performance-critical operations:  AVX AVX2
To enable them in other operations, rebuild TensorFlow with the appropriate compiler flags.
2022-06-09 23:59:00.034114: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1532] Created device /job:localhost/replica:0/task:0/device:GPU:0 with 1373 MB memory:  -> device: 0, name: NVIDIA GeForce MX110, pci bus id: 0000:01:00.0, compute capability: 5.0
Traceback (most recent call last):
  File "C:\Users\Gabriel\codes\federated-learning\src\age-detection.py", line 71, in <module>
    aw.train(epochs = 5)
  File "C:\Users\Gabriel\AppData\Local\Programs\Python\Python310\lib\site-packages\mcnn\make.py", line 106, in train
    model.add(tf.keras.layers.Dense(num_classes, activation = tf.nn.softmax))
NameError: name 'num_classes' is not defined

I am using python 3.10.5 Could you help me to undestand and fix this issue?

anish-lakkapragada commented 2 years ago

this project is kinda sus, I would recommend you don't use it I see the issue basically it shudn't be num_classes but instead len(self.num_to_class)

this project was made for a hackathon and I don't think it works, sorry instead maybe use something like tensorflow to train the model, just my two cents

sorry for not being of help