broadinstitute / keras-rcnn

Keras package for region-based convolutional neural networks (RCNNs)
Other
555 stars 222 forks source link

RCNN __init__() error #177

Closed edisel closed 6 years ago

edisel commented 6 years ago

Hi everyone, I have an error when running the following code :

import keras
from keras.layers import Input
from keras_rcnn.models import RCNN
img_in = Input((None, None, 3))
rcnn_model = RCNN(img_in, 2)

The error message is : Traceback (most recent call last): File "", line 1, in TypeError: init() missing 1 required positional argument: 'regions_of_interest'

I tested on two different machines :

I have installed keras-rcnn using the command pip install. How can I fix that ? Thank you !

jhung0 commented 6 years ago

Did you try downloading from source? What does line 1 refer to?

edisel commented 6 years ago

1) Yes, if I download the .zip from source and install it on CentOS 7, using the command : pip3 install keras-rcnn-master.zip , then I can't import keras-rcnn module in python. I have the following error :

>>> from keras_rcnn.models import RCNN
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/chem/selwa/venvs/tensorflow/lib/python3.4/site-packages/keras_rcnn/models/__init__.py", line 1, in <module>
    from ._rcnn import RCNN
  File "/home/chem/selwa/venvs/tensorflow/lib/python3.4/site-packages/keras_rcnn/models/_rcnn.py", line 10, in <module>
    import keras_rcnn.layers
  File "/home/chem/selwa/venvs/tensorflow/lib/python3.4/site-packages/keras_rcnn/layers/__init__.py", line 1, in <module>
    from .losses import (RCNN, RCNNMaskLoss, RPN)
  File "/home/chem/selwa/venvs/tensorflow/lib/python3.4/site-packages/keras_rcnn/layers/losses/__init__.py", line 56
    return {**super(RCNN, self).get_config(), **configuration}
             ^
SyntaxError: invalid syntax

I don't have that "import" error if I install it using the command : pip3 install keras-rcnn

2) I guess line 1 refers to the first line of the module RCNN...

maryamag85 commented 6 years ago

same issue here in ubuntu 16.04 LST python3.5

pip3 - wheel installation were checked none helped.

edisel commented 6 years ago

I found something similar : https://github.com/broadinstitute/keras-rcnn/issues/140 Apparently it needs at least python 3.6 to run.

jmd9019 commented 6 years ago

@edisel was the issue solved because I am getting same error I am running in jupyter and my python version is 3.6

edisel commented 6 years ago

Yes, installing python3.6 solved the problem for me. I also installed keras-rcnn from git repository because the install using the wheel led to "init()" error. I'm not using jupyter.

jmd9019 commented 6 years ago

Still facing the same issue, these are steps how I installed please correct me if have missed something or installed in wrong way I am running in jupyter with python 3.6 anaconda environment in aws p2 instance.

First I updated keras and tensor, then downloaded zip file and installed using pip installer But still facing the issue.

edisel commented 6 years ago

I'm using neither jupyter, nor anaconda, so I can't help you with this. I installed python36u and created virtualenv as described there : https://janikarhunen.fi/how-to-install-python-3-6-1-on-centos-7.html Then I ran virtualenv, and installed tensorflow, keras, etc, with pip command. Finally I installed keras-rcnn from git repository : pip install git+https://github.com/broadinstitute/keras-rcnn.git or by downloading the .zip file and installing it with pip command (I don't remember how I proceeded this time). Have you tried to remove keras-rcnn and keras and reinstall them ?