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

TypeError: unsupported operand type(s) for +: 'NoneType' and 'str' #41

Open
sd12832 opened this issue Mar 5, 2018 · 7 comments
Open

Comments

@sd12832
Copy link

sd12832 commented Mar 5, 2018

I am currently trying to run the program with Python3 on my Mac OSX. But as I run it with the .sh script, I do not seem to be getting any output. In order to investigate more, I used a simple:

python3 predict.py sample.flac

This gave me the set of errors below:

/usr/local/lib/python3.6/site-packages/h5py/__init__.py:36: FutureWarning: Conversion of the second argument of issubdtype from `float` to `np.floating` is deprecated. In future, it will be treated as `np.float64 == np.dtype(float).type`.
  from ._conv import register_converters as _register_converters
Using TensorFlow backend.
Traceback (most recent call last):
  File "predict.py", line 131, in <module>
    model = InstrumentClassifier(args.model_dir)
  File "predict.py", line 47, in __init__
    self.model = load_model_from_dir(model_dir)
  File "predict.py", line 44, in load_model_from_dir
    model_dir + '/model_arch.yaml',
TypeError: unsupported operand type(s) for +: 'NoneType' and 'str'

Could you please guide me as to the proper procedure to fix this error?

@bzamecnik
Copy link
Owner

bzamecnik commented Mar 5, 2018 via email

@sd12832
Copy link
Author

sd12832 commented Mar 5, 2018

Are you supposed to create a model? In that case, which function should I invoke?

@bzamecnik
Copy link
Owner

I think you can use a pretrained model at https://github.com/bzamecnik/deep-instrument-heroku/tree/master/static/model/2016-10-15_22-11-47_31fdbcbb. Or you train train yours. I hope the README is covering that well.

@bzamecnik
Copy link
Owner

Aah, I see the problem. model_dir CLI arg is required, but not marked as such. You should call:

python3 predict.py sample.flac -m path_to_model/

@sd12832
Copy link
Author

sd12832 commented Mar 5, 2018

Let me try running this. The README was a bit confusing, therefore, I went straight for the .sh wrapper. But since, it was not giving any errors, I went for the predict.py.

Could you detail how to train the model with your own data (I wanted to do this with the available files, but I keep facing various errors).

Are only .flacs accepted as of now?

@sd12832
Copy link
Author

sd12832 commented Mar 9, 2018

Hey, so I tried running this, and I got:

Traceback (most recent call last):
  File "predict.py", line 135, in <module>
    print(model.predict_class_label(args.audio_file))
  File "predict.py", line 98, in predict_class_label
    x_features = self.load_features(audio_file)
  File "predict.py", line 87, in load_features
    x_features = self.ch.transform(x)
AttributeError: 'dict' object has no attribute 'transform'

@sd12832
Copy link
Author

sd12832 commented Mar 9, 2018

Also, I wanted a few things cleared up. Should the entire process() follow this:

extract_features.py -> prepare_training_data.py -> train.py -> predict.py

I understand the inputs to extract_features.py. But what are the inputs into prepare_training_data.py? Could you detail this more?

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