Coder Social home page Coder Social logo

ihaeyong / drama-graph Goto Github PK

View Code? Open in Web Editor NEW
8.0 7.0 1.0 206.06 MB

Drama-Graph repository produces both knowledge base on drama scripts and video graph for Video Turing Test (VTT).

License: MIT License

Python 1.69% Shell 0.01% Jupyter Notebook 98.29%
knowlege-graph video-processing multimodal-deep-learning sound-event-localization caption-generation lexicon-generation place-recognition person-detection behavior-recognition face-detection

drama-graph's Introduction

Git clone this repository.

>> git clone https://github.com/ihaeyong/drama-graph.git

Prepare env. and install requirements:

1. create conda env.
>> conda create -n vtt_env python=3.6
>> source activate vtt_env
2. install pytorch and lib. 
>> conda install pytorch==1.1.0 torchvision==0.3.0 cudatoolkit=9.0 -c pytorch
>> pip install -r requirements.txt

Download AnotherMissOh datasets

Unzip the anothermissoh dataset,

>> mkdir ./data
>> cd data
>> unzip datasets.zip

You can set your data path to 'Yolo_v2_pytorch/src/anotherMissOh_dataset.py' as follows:

img_path = './data/AnotherMissOh/AnotherMissOh_images/AnotherMissOh01/'
json_dir = './data/AnotherMissOh/AnotherMissOh_Visual/AnotherMissOh01_visual.json'

Drama-graph model

We mainly use YOLOv2-pytorch.

You could find all trained models in this link.

We finetuned YOLOv2 w.r.t 20 persons for about 50 epoches as follows:

Train model:

train the integrated model from scratch.

For place recognition, make 'pre_model' folder and put places365 pre-trained model.

>> ./scripts/train_models.sh #gpu

train sound event model from scratch.

>> ./scripts/train_sound_event.sh #gpu

The trained model is saved in ./sound_event_detection/checkpoint/torch_model.pt

Test(drama graph generation) model:

drama graph generation on the all episodes.

>> ./scripts/eval_models.sh #gpu

Evaluation

mAP for person

>> python eval_mAP.py -rtype person

mAP for behavior

>> python eval_mAP.py -rtype behave

mAP for face

>> python eval_mAP.py -rtype face

mAP for relation

>> python eval_mAP.py -rtype relation

mAP for object

>> python eval_mAP.py -rtype object

Accuracy for sound event and its visualization. sed_vis folder should be in the directory from which you run the file(./), so here the directory is (drama-graph/sed_vis/).

>> ./scripts/eval_sound_event.sh
>> ./scripts/inference_sound_event.sh

Performances

model trainset validation test
person detection 54.2% 50.6% 47.3%
face detection 43.9% 25.83 26.6%
emotion 72.6% 80.6% 66.9%
behavior 17.43% 3.9% 4.89%
object detection 2.18% 1.17% 1.33%
predicate 88.1% 88.8% 85.9%
place 61.0% 41.1% 38.8%
sound event 89.6% 69.0% 62.5%

Acknowledgements

This work was supported by Institute for Information & communications Technology Promotion(IITP) grant funded by the Korea government(MSIT) (2017-0-01780, The technology development for event recognition/relational reasoning and learning knowledge based system for video understanding)

drama-graph's People

Contributors

4charwon avatar chojw avatar cyoon47 avatar dcholee avatar fairy-of-9 avatar hobincar avatar ihaeyong avatar ish97 avatar janghoonchoi avatar kkddhh386 avatar qwireq avatar vttcau avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Forkers

hwiyeoljo

drama-graph's Issues

Request on Knowledge graph README

Describe the format of input in more details.

  • How can we input a question into this system as you show in example

Need for explanations on the output formats.

  • what do the frame.gv / triple.gv mean?
  • Also, each label (e.g., Entity, Topical_entity) represents what?

Minor: Add commands to install stanfordnlpcore.

Request on knowledge graph

코드 실행중 다음과 같은 에러가 발생합니다.

root@4a30c3e1a0c7:/new_drama_graph/knowledge_graph# ./run_knowledge_graph.sh
2020-11-03 18:37:37,602 __main__     INFO     Config: {'mode': 'subtitle', 'output_dir': 'data/output', 'preprocessing': {'load': False, 'substitle_file': 'data/input/AnotherMissOh_Scene_Subtitle', 'output_path': 'data/output/preprocessed.json', 'coreference': 'gold'}, 'extraction': {'load': False, 'oie': 'stanford', 'frame': 'frameBERT', 'output_path': 'data/output/extracted.json'}, 'background': {'load': False, 'input_path': 'data/background.txt', 'output_path': 'data/output/background_KB.json'}, 'graph': {'character_name': 'data/character.txt', 'use_backKB': True, 'visualization': 'all', 'package_path': '/usr/share/graphviz', 'graph_path': 'data/output/graphs', 'json_path': 'data/output/graph.json', 'character': 'all', 'only_use': 'None'}}
preprocessing..
Can't match Parentheses: Hey! What are you(Heeran) going to do if I drink this in one shot?)
Can't match Parentheses: You(Heayoung1)'re so gross!)
done..
extracting knowledge..
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/urllib3/connection.py", line 141, in _new_conn
    (self.host, self.port), self.timeout, **extra_kw)
  File "/usr/lib/python3/dist-packages/urllib3/util/connection.py", line 83, in create_connection
    raise err
  File "/usr/lib/python3/dist-packages/urllib3/util/connection.py", line 73, in create_connection
    sock.connect(sa)
ConnectionRefusedError: [Errno 111] Connection refused

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/urllib3/connectionpool.py", line 601, in urlopen
    chunked=chunked)
  File "/usr/lib/python3/dist-packages/urllib3/connectionpool.py", line 357, in _make_request
    conn.request(method, url, **httplib_request_kw)
  File "/usr/lib/python3.6/http/client.py", line 1264, in request
    self._send_request(method, url, body, headers, encode_chunked)
  File "/usr/lib/python3.6/http/client.py", line 1310, in _send_request
    self.endheaders(body, encode_chunked=encode_chunked)
  File "/usr/lib/python3.6/http/client.py", line 1259, in endheaders
    self._send_output(message_body, encode_chunked=encode_chunked)
  File "/usr/lib/python3.6/http/client.py", line 1038, in _send_output
    self.send(msg)
  File "/usr/lib/python3.6/http/client.py", line 976, in send
    self.connect()
  File "/usr/lib/python3/dist-packages/urllib3/connection.py", line 166, in connect
    conn = self._new_conn()
  File "/usr/lib/python3/dist-packages/urllib3/connection.py", line 150, in _new_conn
    self, "Failed to establish a new connection: %s" % e)
urllib3.exceptions.NewConnectionError: <urllib3.connection.HTTPConnection object at 0x7fde63ab7630>: Failed to establish a new connection: [Errno 111] Connection refused

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.6/dist-packages/requests/adapters.py", line 449, in send
    timeout=timeout
  File "/usr/lib/python3/dist-packages/urllib3/connectionpool.py", line 639, in urlopen
    _stacktrace=sys.exc_info()[2])
  File "/usr/lib/python3/dist-packages/urllib3/util/retry.py", line 398, in increment
    raise MaxRetryError(_pool, url, error or ResponseError(cause))
urllib3.exceptions.MaxRetryError: HTTPConnectionPool(host='143.248.135.188', port=1106): Max retries exceeded with url: /frameBERT (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7fde63ab7630>: Failed to establish a new connection: [Errno 111] Connection refused',))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "main.py", line 38, in <module>
    extractor = extractor(config, preprocessor.output)
  File "/new_drama_graph/knowledge_graph/knowledge_extraction/extractor.py", line 15, in __init__
    self.frame = frame(config, self.input)
  File "/new_drama_graph/knowledge_graph/knowledge_extraction/frame.py", line 15, in __init__
    self.output = self.run()
  File "/new_drama_graph/knowledge_graph/knowledge_extraction/frame.py", line 27, in run
    results = eng_frameBERT(sent['statement'])
  File "/new_drama_graph/knowledge_graph/knowledge_extraction/frame.py", line 8, in eng_frameBERT
    response = requests.post(host, data=data, verify=False)
  File "/usr/local/lib/python3.6/dist-packages/requests/api.py", line 119, in post
    return request('post', url, data=data, json=json, **kwargs)
  File "/usr/local/lib/python3.6/dist-packages/requests/api.py", line 61, in request
    return session.request(method=method, url=url, **kwargs)
  File "/usr/local/lib/python3.6/dist-packages/requests/sessions.py", line 530, in request
    resp = self.send(prep, **send_kwargs)
  File "/usr/local/lib/python3.6/dist-packages/requests/sessions.py", line 643, in send
    r = adapter.send(request, **kwargs)
  File "/usr/local/lib/python3.6/dist-packages/requests/adapters.py", line 516, in send
    raise ConnectionError(e, request=request)
requests.exceptions.ConnectionError: HTTPConnectionPool(host='143.248.135.188', port=1106): Max retries exceeded with url: /frameBERT (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7fde63ab7630>: Failed to establish a new connection: [Errno 111] Connection refused',))

서버가 닫혀서 생긴 문제인 것 같은데 해결 요청 드릴 수 있을까요?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.