Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TagLab crashing while starting network training #169

Open
kidconcept opened this issue Nov 27, 2024 · 5 comments
Open

TagLab crashing while starting network training #169

kidconcept opened this issue Nov 27, 2024 · 5 comments

Comments

@kidconcept
Copy link

kidconcept commented Nov 27, 2024

I'm trying to train a network in TagLab, I've segmented and categorized my orthomosiac, and exported the training dataset. When I try and train a network, TagLab crashes immediately. Here is the error message I get.

Traceback (most recent call last):
File "/Applications/TagLab-main/TagLab.py", line 5112, in trainNewNetwork
dataset_train_info, train_loss_values, val_loss_values = training.trainingNetwork(images_dir_train, labels_dir_train,
File "/Applications/TagLab-main/models/training.py", line 264, in trainingNetwork
datasetTrain.computeAverage()
File "/Applications/TagLab-main/models/coral_dataset.py", line 385, in computeAverage
sum = np.zeros((self.CROP_SIZE, self.CROP_SIZE, 3), dtype=np.float)
File "/Users/mermaid-danny/miniconda3/lib/python3.10/site-packages/numpy/init.py", line 324, in getattr
raise AttributeError(former_attrs[attr])
AttributeError: module 'numpy' has no attribute 'float'.
np.float was a deprecated alias for the builtin float. To avoid this error in existing code, use float by itself. Doing this will not modify any behavior and is safe. If you specifically wanted the numpy scalar type, use np.float64 here.
The aliases was originally deprecated in NumPy 1.20; for more details and guidance see the original release note at:
https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations. Did you mean: 'cfloat'?
zsh: abort python3 TagLab.py

My training settings
Screenshot 2024-11-27 at 5 10 24 PM

My project
Screenshot 2024-11-27 at 5 16 14 PM

@maxcorsini
Copy link
Member

maxcorsini commented Nov 28, 2024

Thank you to point out this problem! Fixed.

@kidconcept
Copy link
Author

Thank you for your prompt commit, unfortunately I haven't been able to get the training working after pulling your update due to new and different way's it's crashing.

I tried with my main data set, and it crashed this time while importing the Training data with the following error:
OverflowError: Python integer 256 out of bounds for uint8

So I created a smaller project with just a single label as a test and this time it crashed while importing the training data with the following error:
Traceback (most recent call last): File "/Users/bluegreen/Projects/TagLab-main/source/QtTYNWidget.py", line 200, in chooseDatasetFolder self.analyzeDataset() File "/Users/bluegreen/Projects/TagLab-main/source/QtTYNWidget.py", line 373, in analyzeDataset target_classes, freq_classes = CoralsDataset.importClassesFromDataset(labels_folder, self.project_labels) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/bluegreen/Projects/TagLab-main/models/coral_dataset.py", line 322, in importClassesFromDataset dict_freq[key] = float(dict_freq[key]) / float(total_pixels) ~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~ ZeroDivisionError: float division by zero

Any advice?

@maxcorsini
Copy link
Member

The OverflowError is something unexpected. How many classes do you have ? Please, give us more details.

Regarding the second error, this means that you want to train for a class that is not present in the training dataset. We will fix it in a next release by writing a message instead of crashing.

Best

@kidconcept
Copy link
Author

When you say train for a class that is not present in the training dataset, do you mean train for a class that isn't in the scripps dictionary? I'm attempting to train custom labels for corals that aren't present in the scripps dictionary. To answer your question about the Overflow Error I've got 26 classes in my dictionary, you can see almost all of them in the screenshot posted above. But I've been struggling to get the training working at all, even with only one class and a smaller ortho...

@maxcorsini
Copy link
Member

I mean that some of the classes selected are not present in the training dataset (0.0% in your screenshot). Pay attention that if the amount of pixels of some classes with high probability the classifier will not learn how to recognize these classes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants