OpenBG-IMG is a multi-modal dataset in the field of e-commerce. This benchmark implements a variety of knowledge graph embedding models for link prediction, which is used to generate evaluation results of CCKS2022 Knowledge Processing and Application Evaluation for Digital Commerce Task 3: Multimodal Commodity Knowledge Graph Link Prediction. Please submit the results to TIANCHI platform.
Use the following code to configure the environment.
pip install -r requirements.txt
Please download the dataset from TIANCHI to the directory ./data/
.
data
|-- OpenBG-IMG
| |-- images # Set of images
| | |-- ent_xxxxxx # Images of the entity
| | |-- ...
| |-- train.tsv # Training set
| |-- test.tsv # Test set
The statistics of OpenBG-IMG:
Dataset | # Ent | # Rel | # Train | # Dev | # Test |
---|---|---|---|---|---|
OpenBG-IMG | 27,910† | 136 | 230,087 | 5,000 | 14,675 |
†: there are 14,718 multi-modal entities in OpenBG-IMG.
$ head -n 3 train.tsv
ent_021198 rel_0031 ent_017656
ent_008185 rel_0092 ent_025949
ent_005940 rel_0080 ent_020805
These models refer to the implement of OpenKE.
- Compile C++ files
cd [The root directory of model]
bash scripts/make.sh
- Preprocess data
bash scripts/prepro.sh
- Train model and predict results saved to
./results/result.tsv
bash scripts/train.sh
The model refers to the implement of TuckER.
- Preprocess data
bash scripts/prepro.sh
- Train model and predict results saved to
./results/result.tsv
bash scripts/train.sh
The model refers to the implement of the TransE model in OpenKE and the process of images in TransAE.
- Compile C++ files
cd TransAE
bash scripts/make.sh
- Preprocess data
bash scripts/prepro.sh
- Get representations and encodings of images
bash scripts/visual_emb.sh
- Train model and predict results saved to
./results/result.tsv
bash scripts/train.sh
The model refers to the implement of RSME.
- Get representations and encodings of images
cd RSME
bash scripts/visual_emb.sh
- Preprocess data
bash scripts/prepro.sh
- Train model and predict results saved to
./results/result.tsv
bash scripts/train.sh
Model | HIT@1 | HIT@3 | HIT@10 | MR | MRR |
---|---|---|---|---|---|
TransE | 0.150 | 0.387 | 0.647 | 118 | 0.315 |
TransH | 0.129 | 0.525 | 0.743 | 112 | 0.357 |
TransD | 0.137 | 0.532 | 0.746 | 110 | 0.364 |
DistMult | 0.060 | 0.157 | 0.279 | 524 | 0.139 |
ComplEx | 0.143 | 0.244 | 0.371 | 782 | 0.221 |
TuckER | 0.497 | 0.690 | 0.820 | 1473 | 0.611 |
TransAE | 0.274 | 0.489 | 0.715 | 36.1 | 0.421 |
RSME | 0.485 | 0.687 | 0.838 | 72.1 | 0.607 |
Thanks for the following works!
- https://github.com/thunlp/OpenKE
- https://github.com/ibalazevic/TuckER
- https://github.com/ksolaiman/TransAE
- https://github.com/wangmengsd/RSME
Multi-modal Knowledge Graph completion: MKGFormer(https://github.com/zjunlp/MKGformer/)