InnerPeace-Wu / densecap-tensorflow

Re-implement CVPR2017 paper: "dense captioning with joint inference and visual context" and minor changes in Tensorflow. (mAP 8.296 after 500k iters of training)
MIT License
61 stars 28 forks source link

ValueError: Attempted relative import beyond toplevel package #43

Open ifmaq1 opened 2 years ago

ifmaq1 commented 2 years ago

Hi, I am running a code on ubuntu server. I uploaded this project in my home directory and trying to generate captions on custom images using

$ bash scripts/dense_cap_demo.sh output/ckpt output/ckpt/vocabulary.txt

I created the data/demo and outputfile in this project's directory i-e

/home/densecap-tensorflow-master/data/demo

When I run bash scripts/dense_cap_demo.sh output/ckpt output/ckpt/vocabulary.txt

it gives me following error

+ set -e
+ ckpt=output/ckpt
+ vocab=output/ckpt/vocabulary.txt
+ '[' -d /home/joe ']'
+ python ./tools/demo.py --ckpt output/ckpt --cfg scripts/dense_cap_config.yml --vocab output/ckpt/vocabulary.txt --set TEST.USE_BEAM_SEARCH False EMBED_DIM 512 TEST.LN_FACTOR 1. TEST.RPN_NMS_THRESH 0.7 TEST.NMS 0.3
Traceback (most recent call last):
  File "./tools/demo.py", line 28, in <module>
    import tensorflow as tf
  File "/usr/local/lib/python2.7/dist-packages/tensorflow/__init__.py", line 99, in <module>
    from tensorflow_core import *
  File "/usr/local/lib/python2.7/dist-packages/tensorflow_core/__init__.py", line 34, in <module>
    from tensorflow._api.v1 import autograph
  File "/usr/local/lib/python2.7/dist-packages/tensorflow_core/_api/v1/autograph/__init__.py", line 22, in <module>
    from tensorflow._api.v1.autograph import experimental
  File "/usr/local/lib/python2.7/dist-packages/tensorflow_core/_api/v1/autograph/experimental/__init__.py", line 10, in <module>
    from tensorflow.python.autograph.core.converter import Feature
  File "/usr/local/lib/python2.7/dist-packages/tensorflow_core/python/autograph/__init__.py", line 35, in <module>
    from tensorflow.python.autograph import operators
  File "/usr/local/lib/python2.7/dist-packages/tensorflow_core/python/autograph/operators/__init__.py", line 40, in <module>
    from tensorflow.python.autograph.operators.control_flow import for_stmt
  File "/usr/local/lib/python2.7/dist-packages/tensorflow_core/python/autograph/operators/control_flow.py", line 65, in <module>
    from tensorflow.python.autograph.operators import py_builtins
  File "/usr/local/lib/python2.7/dist-packages/tensorflow_core/python/autograph/operators/py_builtins.py", line 30, in <module>
    from tensorflow.python.data.ops import dataset_ops
  File "/usr/local/lib/python2.7/dist-packages/tensorflow_core/python/data/__init__.py", line 25, in <module>
    from tensorflow.python.data import experimental
  File "/usr/local/lib/python2.7/dist-packages/tensorflow_core/python/data/experimental/__init__.py", line 89, in <module>
    from tensorflow.python.data.experimental.ops.batching import dense_to_sparse_batch
  File "/usr/local/lib/python2.7/dist-packages/tensorflow_core/python/data/experimental/ops/batching.py", line 20, in <module>
    from tensorflow.python.data.ops import dataset_ops
  File "/usr/local/lib/python2.7/dist-packages/tensorflow_core/python/data/ops/dataset_ops.py", line 70, in <module>
    from tensorflow.python.training.tracking import tracking
  File "/usr/local/lib/python2.7/dist-packages/tensorflow_core/python/training/tracking/tracking.py", line 29, in <module>
    from tensorflow.python.training.tracking import data_structures
  File "/usr/local/lib/python2.7/dist-packages/tensorflow_core/python/training/tracking/data_structures.py", line 30, in <module>
    from .....third_party import wrapt
ValueError: Attempted relative import beyond toplevel package

how can i solve this issue. I cannot create directories in root folder as there are other users as well. I have access to my home directory only.

ifmaq1 commented 2 years ago

any response?