DECIMER - Towards Deep Learning for Chemical Image Recognition
The automatic recognition of chemical structure diagrams from the literature is an indispensable component of workflows to re-discover information about chemicals and to make it available in open-access databases. Here we report preliminary findings in our development of DECIMER (Deep lEarning for Chemical ImagE Recognition), a deep learning method based on existing show-and-tell deep neural networks which makes very few assumptions about the structure of the underlying problem. The training state reported here does not yet rival the performance of existing traditional approaches, but we present evidence that our method will reach a comparable detection power with sufficient training time. Training success of DECIMER depends on the input data representation: DeepSMILES are clearly superior over SMILES and we have preliminary indication that the recently reported SELFIES outperform DeepSMILES. An extrapolation of our results towards larger training data sizes suggest that we might be able to achieve >90% accuracy with about 60 to 100 million training structures, so that training can be completed within several months on a single GPU. This work is completely based on open-source software and open data and is available to the general public for any purpose.
DECIMER - 화학적 이미지 인식을 위한 딥러닝 방향
문헌으로부터 화학구조도의 자동인식은 화학물질에 대한 정보를 다시 검색하고 개방형 접속 데이터베이스에서 사용할 수 있도록 하기 위해 워크플로우의 필수 불가결한 구성요소다. 여기서는 기존의 쇼 앤 텔 심층 신경 네트워크를 기반으로 한 심층 학습 방법인 DECIMER(Deep learning for Chemical ImagE Incognition) 개발에서 근본적인 문제의 구조에 대해 거의 가정을 하지 않는 예비 결과를 보고한다. 여기에 보고된 훈련 상태는 아직 기존의 전통적인 접근방식의 성과에 필적하지 않지만, 우리는 우리의 방법이 충분한 훈련 시간을 가지고 비교 가능한 탐지력에 도달할 것이라는 증거를 제시한다. DECIMER의 교육 성공 여부는 입력 데이터 표현에 따라 결정된다. 딥 SMiles는 확실히 스마일즈보다 우위에 있으며 우리는 최근에 보고된 SELEFIES가 딥을 능가한다는 예비적인 징후를 가지고 있다. 스마일즈. 더 큰 훈련 데이터 크기에 대한 우리의 결과를 추론해 보면, 우리가 약 6천만에서 1억 개의 훈련 구조로 90% 이상의 정확도를 달성할 수 있다는 것을 암시한다. 그래서 단일 GPU로 수개월 내에 훈련을 완료할 수 있다. 이 작업은 완전히 오픈 소스 소프트웨어와 오픈 데이터를 기반으로 하며 일반인들이 이용할 수 있다. 어떤 목적으로든 공개하다.
Introduction
The automatic recognition of chemical structure diagrams from the chemical literature (herein termed Optical Chemical Entity Recognition, OCER) is an indispensable component of workflows to re-discover information about chemicals and to make it available in open-access databases. While the chemical structure is often at the heart of the findings reported in chemical articles, further information about the structure is present either in textual form or in other types of diagrams such as titration curves, spectra, etc. (Figure 1).
Previous software systems for OCER been described and were both incorporated into commercial and open source systems. These software systems include Kekulé [1-2], the Contreras system [3], the IBM system [4], CLIDE [5] as well as the open source approaches chemOCR [6-8] , ChemReader [9] and OSRA [10].
소개
화학 문헌으로부터 화학 구조 다이어그램의 자동 인식(이하 광학 화학 개체 인식, OCER라 함)은 화학 물질에 대한 정보를 다시 검색하고 개방형 액세스 데이터베이스에서 사용할 수 있도록 하기 위해 워크플로우의 필수적인 구성요소다. 화학적 구조가 종종 화학 기사에 보고된 소견의 핵심에 있지만, 구조에 대한 추가 정보는 텍스트 형식이나 적정 곡선, 스펙트럼 등과 같은 다른 유형의 다이어그램에 존재한다(그림 1).
OCER를 위한 이전 소프트웨어 시스템이 설명되었고, 내부 및 오픈 소스 시스템 둘 다 통합되었다. 이러한 소프트웨어 시스템에는 Kekulé[1-2], Contreras 시스템[3], IBM 시스템[4], CLIDE [5] 및 오픈 소스 접근법이 포함된다.OCR [6-8] , ChemReader [9] 및 OSRA [10]
A general approach to the problem is shared by all of these software packages, comprising steps a) scanning, b) vectorization, c) searching for dashed lines and dashed wedges, d) character recognition, e) graph compilation, f) post processing and d) display and editing.
Each of the steps in such systems need to be carefully hand-tuned both individually as well as for its interplay with the other steps. The incorporation of new image features to be detected is a laborious process.
문제에 대한 일반적인 접근방식은 이러한 모든 소프트웨어 패키지에 의해 공유되며, 여기에는 a) 스캔, b) 벡터화, c) 점선 및 점선 웨지 검색, d) 문자 인식, e) 그래프 컴파일, f) 후 처리 및 편집이 포함된다.
그러한 시스템의 각 단계는 다른 단계와의 상호작용을 위해서 뿐만 아니라 개별적으로 신중하게 조정되어야 한다. 감지해야 할 새로운 이미지 기능의 통합은 힘든 과정이다.
We were recently inspired by the stunning success of AlphaGo Zero [12], a deep neural network (NN) based approach that enabled AlphaGo Zero to reach superhuman strength in the Game of Go by playing a potentially unlimited number of games against itself, starting with no more knowledge than the basic rules of the game. In this example, as well as in other prominent examples of successful deep learning, the key to success was the availability of a potentially unlimited or very large amount of training data.
우리는 최근 알파고 제로가 게임의 기본 규칙보다 더 많은 지식 없이 자신들을 상대로 잠재적으로 무제한의 게임을 함으로써 바둑의 게임에서 초인적인 힘을 발휘할 수 있도록 한 깊은 신경망(NN) 기반의 접근방식인 알파고 제로의 놀라운 성공에 영감을 받았다. 이 예에서뿐만 아니라 성공적인 딥러닝의 다른 두드러진 예에서도 성공의 열쇠는 잠재적으로 무제한 또는 매우 많은 양의 훈련 데이터를 이용할 수 있는 것이었다.
The example of AlphaGo Zero made us realize that we are in a similar situation for the visual computing challenge described above. Instead of working with a necessarily small corpus of human-annotated examples from the printed literature, as has been common in the text mining and machine learning applications in chemistry in the past, we realised that we could generate training data from a practically unlimited source of structures generated by structure generators or by using the largest collections of open chemical data available to mankind.
알파고 제로(AlphaGo Zero)의 예는 앞에서 설명한 시각 컴퓨팅 도전에 대해서도 우리가 비슷한 상황에 처해 있음을 깨닫게 했다. 과거 화학의 텍스트 마이닝과 머신러닝 애플리케이션에서 흔히 볼 수 있듯이, 인쇄된 문헌에서 반드시 인간에게 공지된 사례의 작은 말뭉치로 작업하는 대신에, 우리는 구조 생성기에 의해 생성되거나 인류가 이용할 수 있는 가장 큰 개방된 화학 데이터 컬렉션을 사용하여 실질적으로 무제한의 구조 원천으로부터 훈련 데이터를 생성할 수 있다는 것을 깨달았다. --> 구조 생성기가 무엇이지?
After we started our work presented here, other attempts to use deep learning for OCER were reported. Work by the Schrödinger group [13] reports the successful extraction of machine-readable chemical structures from bitmaps but no software system available for the general public to replicate the reported results. A method called Chemgrapher [14] suggests to deal with the problem in a modular fashion by using a segmentation algorithm to segment the
images containing chemical graphs to detect atoms locations, bonds and charges separately, and employ a graph building algorithm to re-generate the chemical graph.
Here we report preliminary findings of our development of DECIMER (Deep lEarning for Chemical ImagE Recognition), a deep learning method based on existing show-and-tell deep neural networks which, unlike for example Chemgrapher, makes very few assumptions about the structure of the underlying problem. The training state reported here does not yet rival the performance of existing traditional approaches, but we present evidence that, given sufficient training time, our method will reach a comparable detection power without the need of the sophisticated engineering steps of an OCER workflow.
우리가 여기서 우리의 일을 시작한 후, OCER를 위해 딥러닝을 사용하려는 다른 시도들이 보고되었다. 슈뢰딩거 그룹[13]의 연구는 비트맵에서 기계 판독이 가능한 화학 구조를 성공적으로 추출했지만 일반 대중이 보고된 결과를 복제할 수 있는 소프트웨어 시스템은 없다고 보고한다. Chemgrapher[14]라 불리는 방법은 분할 알고리즘을 사용하여 문제를 분할하여 모듈식으로 처리할 것을 제안한다.
원자의 위치, 결합 및 전하를 개별적으로 검출하고, 화학 그래프를 재조정하기 위해 그래프 작성 알고리즘을 사용하는 화학 그래프를 포함하는 이미지.
여기서는 기존의 쇼 앤 텔 심층 신경 네트워크를 기반으로 한 심층 학습 방인 DECIMER(Deep learning for Chemical ImagE Incognition)의 개발에 대한 예비 결과를 보고하며, 예를 들어 Chemgrapher와 달리 근본적인 문제의 구조에 대해 거의 가정하지 않는다. 여기에 보고된 교육 상태는 아직 기존의 전통적인 접근방식의 성과에 필적하지 않지만, 충분한 교육 시간을 감안할 때, 우리의 방
법이 OCER 워크플로우의 정교한 엔지니어링 단계 없이도 비교할 수 있는 탐지력에 도달할 것이라는 증거를 제시한다.
Method
The principal idea reported here is to repurpose a show-and-tell deep NN designed for general photo annotation earlier and train it to report series of SMILES tokens when presented with bitmaps of chemical structures. The original NN reported sentences like “A giraffe standing in a forest with trees in the background” when presented with a corresponding photo.
방법
여기에 보고된 주요 아이디어는 앞서 일반 사진 주석용으로 설계된 쇼앤텔 심층 NN을 용도 변경하고, 화학 구조의 비트맵이 제시될 경우 일련의 스마일리지 토큰을 보고하도록 교육하는 것이다. 원본 NN은 해당 사진과 함께 "나무들이 있는 숲에 서 있는 기린"과 같은 문장을 보도했다.
Data
Instead of abstracting chemical diagrams from the chemical literature to generate training data, we decided to use structure diagram generators (SDG) like the one found in the Chemistry
Development Kit (CDK) [15] to generate a potentially unlimited amount of training data. This type of training data can be accommodated to become more realistic and comparable to the
varying picture quality in the chemical literature by using image manipulation such as blurring, adding noise, etc. As a source of input structures for the CDK SDG, we turned to PubChem [16], one of the largest databases of organic molecules. The following rules were used to curate the Pubchem data for our work presented here (in future versions of this deep NN, these rules might be relaxed):
데이터
화학 문헌에서 화학 도표를 추출하여 훈련 데이터를 생성하는 대신, 화학 개발 키트(CDK)[15]에서 발견된 것과 같은 구조 다이어그램 생성기(SDG)를 사용하여 잠재적으로 무제한의 훈련 데이터를 생성하기로 했다.
이러한 유형의 훈련 데이터를 수용하여 흐림, 잡음 추가 등과 같은 이미지 조작을 통해 화학 문헌에서 나타나는 화질에 비견할 수 있다. CDK SDG의 입력 구조의 원천으로서, 우리는 유기 분자의 가장 큰 데이터베이스 중 하나인 PubChem[16]을 이용했다. 여기에 제시된 작업에 대한 Pubchem 데이터를 큐레이션하기 위해 다음과 같은 규칙이 사용되었다(이 깊은 NN의 미래 버전에서는 이러한 규칙이 완화될 수 있다).
Molecules must
● have a molecular weight of fewer than 1500 Daltons,
● not possess counter ions,
● only contain the elements C, H, O, N, P, S, F, Cl, Br, I, Se and B,
● not contain isotopes of Hydrogens (D, T),
● have 5 - 40 bonds,
● not contain any charged groups,
● only contain implicit hydrogens, except in functional groups,
● have less than 40 SMILES characters.
분자는 반드시
● 분자중량이 1500달톤 이하,
● 카운터 이온을 보유하지 않음,
● C, H, O, N, P, S, F, Cl, Br, I, SE, B 원소만 포함한다.
● 하이드로겐 동위 원소(D, T),
● 5~40개의 채권을 가지고 있으며,
● 충전된 그룹을 포함하지 않음,
● 함축성 있는 하이드로겐만 포함, 기능 그룹 제외,
● 스마일즈 캐릭터가 40명 미만임.
The generation of molecular bitmap images from chemical graphs was performed using the CDK SDG, which generates production quality 2D depictions to feed the deep learning algorithm
The text data used here were SMILES [17] strings which were encoded into different formats, regular SMILES, DeepSMILES [18] and SELFIES [19], to test the dependency of the learning success on the data representation.
These datasets were used in different training models in order to evaluate their performance for our use case.
Here we report our results for DeepSMILES, where we currently have the richest set of data
화학 그래프에서 분자 비트 맵 이미지를 생성하는 것은 CDK SDG를 사용하여 수행되었으며, 이는 딥 러닝 알고리즘을 제공하기 위해 생산 품질의 2D 묘사를 생성합니다.
여기에 사용 된 텍스트 데이터는 데이터 표현에 대한 학습 성공의 종속성을 테스트하기 위해 다양한 형식으로 인코딩 된 SMILES [17] 문자열, 일반 SMILES, DeepSMILES [18] 및 SELFIES [19]입니다.
이러한 데이터 세트는 사용 사례에 대한 성능을 평가하기 위해 다양한 학습 모델에서 사용되었습니다.
여기에서 우리는 현재 가장 풍부한 데이터 세트를 보유하고있는 DeepSMILES에 대한 결과를보고합니다.
Model
For the model (Figure 2), we employed an autoencoder- based network with TensorFlow 2.0 [20] at the backend, based on the model designed by Xu et al., 2015 [21], in their work on Show, Attend and Tell, where they demonstrate a higher accuracy for an Image caption generation system with the attention mechanism. The encoder network is a convolutional NN (CNN) which consists of a single fully connected layer and a RELU activation function. The decoder network is a recurrent NN (RNN), consisting of a gated recurrent unit (GRU), 2 fully connected layers and a soft attention mechanism, which was introduced by Bahdanau, Cho, & Bengio in 2015[22].
모델
모델 (그림 2)의 경우 Show, Attend 및 Tell에 대한 작업에서 Xu 등, 2015 [21]에 의해 설계된 모델을 기반으로 백엔드에서 TensorFlow 2.0 [20]이 포함 된 자동 인코더 기반 네트워크를 사용했습니다. , 여기서는주의 메커니즘을 사용하는 이미지 캡션 생성 시스템에 대해 더 높은 정확도를 보여줍니다. 인코더 네트워크는 단일 완전 연결 계층과 RELU 활성화 기능으로 구성된 컨볼 루션 NN (CNN)입니다. 디코더 네트워크는 GRU (gated recurrent unit), 2 개의 완전 연결 계층 및 Bahdanau, Cho 및 Bengio가 2015 년에 도입 한 소프트 어텐션 메커니즘으로 구성된 RNN (Recurrent NN)입니다 [22].
We trained the model with DeepSMILES textual data and the corresponding bitmap of the chemical diagram. The text file is read by the model, the DeepSMILES is tokenized by the tokenizer and the unique tokens are stored. The images are converted into feature vectors by using the Inception V3 [23] model and saved as NumPy arrays.
The model accuracy is determined by the average of all the calculated Tanimoto similarity scores as well as the number of Tanimoto 1.0 hits.
DeepSMILES 텍스트 데이터와 화학 다이어그램의 해당 비트 맵으로 모델을 훈련했습니다. 모델이 텍스트 파일을 읽고, DeepSMILES는 토크 나이저에 의해 토큰 화되며 고유 토큰이 저장됩니다. 이미지는 Inception V3 [23] 모델을 사용하여 특징 벡터로 변환되고 NumPy 배열로 저장됩니다.
모델 정확도는 계산 된 모든 Tanimoto 유사성 점수의 평균과 Tanimoto 1.0 히트 수에 의해 결정됩니다.
Training
Initially, we trained multiple models with small training datasets to obtain the best hyper-parameters for our network. Exploration of the hyperparameter space led to 640 images per batch size, with embedding dimension size of 600 for the images which we depicted on a 299 x 299 canvas size to match the Inception V3 model. We used an Adam optimizer with a learning rate 0.0005 and Sparse Categorical Cross entropy to calculate the loss. We trained all the models for 25 epochs which typically led to convergence. Once the models converged, we started the evaluation of the test set.
훈련
처음에는 소규모 훈련 데이터 세트로 여러 모델을 훈련하여 네트워크에 가장 적합한 하이퍼 매개 변수를 얻었습니다. 하이퍼 파라미터 공간을 탐색 한 결과 배치 크기 당 640 개의 이미지가 생성되었으며 Inception V3 모델과 일치하도록 299 x 299 캔버스 크기로 묘사 한 이미지의 경우 600의 임베딩 차원 크기를 사용했습니다. 학습률이 0.0005 인 Adam Optimizer Sparse Categorical Cross 엔트로피를 사용하여 손실을 계산했습니다. 우리는 일반적으로 수렴으로 이어지는 25 개의 epoch 동안 모든 모델을 훈련했습니다. 모델이 수렴되면 테스트 세트의 평가를 시작했습니다.
The models were trained on an inhouse server equipped with an nVidia Tesla V100 Graphics Card, 384GB of RAM and two Intel(R) Xeon(R) Gold 6230 CPUs. Even though the training completely happens on the GPU, the initial dataset preparation was CPU-based. Training time obviously scales with data size (Table 1). Model success was evaluated with an independent test data set. During the preparation of this manuscript, initial experiments with parallel training indicated that scaling was not satisfactory beyond 2 or 3 GPUs.
이 모델은 nVidia Tesla V100 그래픽 카드, 384GB RAM 및 2 개의 Intel (R) Xeon (R) Gold 6230 CPU가 장착 된 사내 서버에서 학습되었습니다. 훈련은 GPU에서 완전히 이루어 지지만 초기 데이터 세트 준비는 CPU 기반이었습니다. 훈련 시간은 분명히 데이터 크기에 따라 확장됩니다 (표 1). 모델 성공은 독립적 인 테스트 데이터 세트로 평가되었습니다. 이 원고를 준비하는 동안 병렬 교육을 사용한 초기 실험에서 2 개 또는 3 개의 GPU를 초과하는 확장이 만족스럽지 않음을 나타 냈습니다.
Results
Here we report our results for training data sizes between 54,000 and 15,000,000 structures, with the largest training data set taking 27 days to converge on the hardware reported above (Table 1).
Figure 4 shows the growth of the accuracy of predictions with increasing train data size
결과
여기에서는 54,000에서 15,000,000 구조 사이의 훈련 데이터 크기에 대한 결과를보고합니다. 가장 큰 훈련 데이터 세트는 위에보고 된 하드웨어에 수렴하는 데 27 일이 걸립니다 (표 1).
그림 4는 훈련 데이터 크기가 증가함에 따라 예측 정확도가 증가하는 것을 보여줍니다.
Training success was determined with a number of indicators (Figure 4), such as the percentage of Tanimoto 1.0 predictions, the average Tanimoto similarity over all predictions and the percentage of invalid SMILES produced by the model.
훈련 성공은 Tanimoto 1.0 예측의 백분율, 모든 예측에 대한 평균 Tanimoto 유사성 및 모델에 의해 생성 된 유효하지 않은 SMILES의 백분율과 같은 여러 지표 (그림 4)로 결정되었습니다.
Figure 4a demonstrates that the model’s ability to produce valid SMILES and avoid invalid ones steeply increases with larger training datasets.
그림 4a는 유효한 SMILES를 생성하고 유효하지 않은 SMILES를 방지하는 모델의 능력이 학습 데이터 세트가 클수록 급격히 증가 함을 보여줍니다.
The same can be observed for the two key parameters of this application, the average Tanimoto similarity and the Tanimoto 1.0 percentage, which indicate the fitness of the model to accurately generate a machine readable structure from a bitmap of a chemical diagram.
이 응용 프로그램의 두 가지 주요 매개 변수 인 평균 Tanimoto 유사성과 Tanimoto 1.0 백분율에 대해서도 동일하게 관찰 될 수 있습니다. 이는 화학 다이어그램의 비트 맵에서 기계 판독 가능 구조를 정확하게 생성하기위한 모델의 적합성을 나타냅니다.
We further evaluated the models’ success with additional descriptors such as LogP and Ring count between original and the predicted SMILES, which indicates that the model consistently produces better and better machine representations with growing training data size.
The improvements do not seem to converge prematurely. More detailed results will be reported in a full paper later
또한 원본과 예측 SMILES 사이의 LogP 및 Ring count와 같은 추가 설명자를 사용하여 모델의 성공을 평가했습니다. 이는 모델이 학습 데이터 크기가 증가함에 따라 지속적으로 더 좋고 더 나은 기계 표현을 생성 함을 나타냅니다.
개선 사항이 조기에 수렴되지 않는 것 같습니다. 더 자세한 결과는 나중에 전체 논문에보고됩니다.
In order to assess the promise of these preliminary results, we performed an idealistic linear extrapolation of our data toward larger training data sizes, which indicate that close to perfect detection of chemical structures would require training data sizes between 50 and 60 million structures. Such a training data volume will likely require a training time of 4 months with our setup with a single GPU..
We are currently experimenting with the distributed learning solution currently available in the Tensorflow 2.0 API to significantly reduce this training time, also evaluating Google’s Tensor Processing Units (TPU).
이러한 예비 결과의 가능성을 평가하기 위해 더 큰 훈련 데이터 크기에 대한 데이터의 이상적인 선형 외삽을 수행했습니다. 이는 화학 구조를 완벽하게 감지하려면 5 천만에서 6 천만 구조 사이의 훈련 데이터 크기가 필요함을 나타냅니다. 이러한 훈련 데이터 볼륨은 단일 GPU로 설정 한 경우 4 개월의 훈련 시간이 필요할 수 있습니다.
현재 Tensorflow 2.0 API에서 사용할 수있는 분산 학습 솔루션을 실험하여이 학습 시간을 크게 줄이고 Google의 Tensor Processing Unit (TPU)도 평가하고 있습니다.
Conclusion
Here we have presented preliminary results indicating that a show-and-tell deep neural network setup has the potential to successfully extract a machine-readable structure representation when trained with tens of millions of examples. The training setup makes minimal assumptions about the problem. Training success depended on the input data representation. DeepSMILES were clearly superior over SMILES and we have the preliminary indication that the recently reported SELFIES outperform DeepSMILES. An extrapolation of our results towards larger training data sizes suggests that we might be able to achieve >90% accuracy with 60 to 100 million training structures. Such training can be completed in uncomfortable but feasible time spans of several months on a single GPU. Our work is completely based on open-source software and open data and is available to the general public for any purpose. We are currently moving towards larger training sets with the use of parallelization and more powerful hardware and hope to report the results in a full paper on this work in due time
여기에서 우리는 수천만 개의 예제로 훈련되었을 때 보여주고 말해주는 심층 신경망 설정이 기계 판독 가능한 구조 표현을 성공적으로 추출 할 가능성이 있음을 나타내는 예비 결과를 제시했습니다. 훈련 설정은 문제에 대해 최소한의 가정을합니다.
훈련 성공은 입력 데이터 표현에 달려 있습니다. DeepSMILES는 SMILES보다 분명히 우수했으며 최근에보고 된 SELFIES가 DeepSMILES를 능가한다는 예비 징후가 있습니다. 더 큰 훈련 데이터 크기에 대한 결과를 외삽하면 6 천만 ~ 1 억 개의 훈련 구조로 90 % 이상의 정확도를 달성 할 수 있음을 알 수 있습니다. 이러한 교육은 불편하지만 단일 GPU에서 몇 달 동안 실행 가능한 시간 내에 완료 할 수 있습니다. 우리의 작업은 전적으로 오픈 소스 소프트웨어와 오픈 데이터를 기반으로하며 어떤 목적 으로든 일반 대중이 사용할 수 있습니다. 우리는 현재 병렬화 및 더 강력한 하드웨어를 사용하여 더 큰 훈련 세트로 이동하고 있으며 적시에이 작업에 대한 전체 문서에 결과를보고 할 수 있기를 바랍니다