안녕하세요

구글에서 제공해주는 Colab(Colaboratory)을 이용해 MNIST코딩을 해보는 중

TensorFlow 버전 별 MNIST import 방식이 다른 듯 하여 포스팅해놓습니다.

 

결론적으로

TensorFlow 2.0 버전의 튜토리얼이 자세히 나와있어 2.0 버전으로 공부하는 것이 괜찮을 것 같습니다.

1. Tensorflow 2.x 에서 Tensorflow 1.x 방식으로 MNIST import 오류

TensorFlow 1.x 에서는 아래 패키지를 import하게 되어있습니다.

  -> from tensorflow.examples.tutorials.mnist import input_data

 

제가 산 책이 Tensorflow 1.x 버전이었는데 Colab TensorFlow가 2.2 버전 이었기에 아래와 같이 오류가 발생했습니다.

github issue를 검색해보니 2.x버전부터는 아래 MNIST 예제 패키지를 제공하지 않는 것 같습니다.

 

Tensorflow 2.x 방식에서의 MNIST import 오류

Github issue 의견들

출처 : https://github.com/tensorflow/tensorflow/issues/34083

2. MNIST 데이터 import 오류 해결

  1) TensorFlow 2.x 버전으로 설치한 뒤 tf.keras.datasets.mnist의 사용

      구글에서 제공하는 TensorFlow 2.0를 보면 tf.keras.datasets.mnist를 사용해 MNIST 데이터셋을 import합니다.

      아래 참조 튜토리얼 가이드대로 학습하면 됩니다.

참조 : https://www.tensorflow.org/tutorials/quickstart/beginner?hl=ko

 

텐서플로 2.0 시작하기: 초보자용  |  TensorFlow Core

Note: 이 문서는 텐서플로 커뮤니티에서 번역했습니다. 커뮤니티 번역 활동의 특성상 정확한 번역과 최신 내용을 반영하기 위해 노력함에도 불구하고 공식 영문 문서의 내용과 일치하지 않을 수

www.tensorflow.org

  2) TensorFlow 1.x 버전으로 다운그레이드 한 뒤 from tensorflow.examples.tutorials.mnist import 사용

      Tensorflow 1.x 버전으로 다운그레이드 한 뒤

      from tensorflow.examples.tutorials.mnist import input_data를 통해 데이터셋을 import합니다.

      많은 책 및 블로그가 현재도 1.x 버전 기준으로 설명하고 있기에 간단하게 실습하기는 더 편한 것 같습니다.

 

  3) Local에 MNIST 데이터셋을 저장하여 import 사용

       버전과 관련 없이 Local폴더에 MNIST Dataset을 저장하여 활용합니다.

'AI' 카테고리의 다른 글

EU AI 백서(White Paper)  (0) 2020.03.08

안녕하세요.

2020.02.19 EU에서 AI 백서를 발간했습니다.

구체적인 Policy를 담고있다기 보다는 초안입니다.

 

현재 세계 AI를 주도하는 곳은 미국과 중국입니다.

미국은 실리콘밸리를 중심으로 AI 발전을 주도하고 있으며

중국은 국가정책중심으로 AI산업을 키우고 있습니다.

EU는 위 두 국가에 비해 AI Driven이 부족한 것은 사실입니다.

 

그에따라

EU는 EU나름의 AI 시대에 맞는 Policy가 필요하게 되었고

EU AI 백서도 EU GDPR과 같이 EU중심의 규제+산업발전으로 정책 방향이 나타나 있습니다.

 

이건 제 생각이지만 이런 방향은 아마도

Digital산업을 선도하지 못하는 EU의 자기 방어적인 측면

어떻게보면 미국 AFGA(Apple+FaceBook+Google+Amazon) Digital 거대 공룡에

EU 자국 산업을 지켜야하는, 그리고 EU AI 백서를 통해 EU 내 성공적인 AI 생태계 형성을 염원하는

그런 방향성이 담겨져 있습니다.

(일견 우리나라도 비슷한 실정이지요.. ^^)

EU AI 백서(White Paper)의  핵심 내용은 아래와 같습니다.

전체 내용은 첨부된 EU AI WhitePaper를 보시면 됩니다.

 

EU AI White Paper.pdf
0.92MB

[EU의 AI에 대한 접근]

At the same time, Artificial Intelligence (AI) entails a number of potential risks, such as opaque decision-making, gender-based or other kinds of discrimination, intrusion in our private lives or being used for criminal purposes

-> 결과를 설명하지 못하는 AI, 성별 차별, 사생활 침해 등의 AI 문제에 대한 접근이 필요

 

Thus, the Commission supports a regulatory and investment oriented approach with the twin objective of promoting the uptake of AI and of addressing the risks associated with certain uses of this new technology.

The purpose of this White Paper is to set out policy options on how to achieve these objectives.

-> 위원회는 규제 측면AI 투자 측면에서 지원하고,

     EU AI 백서는 러한 목표들을 어떻게 달성시키는지 정책적 Option을 주는 것이 핵심

 

 

[1. INTRODUCTION]

Europe can combine its technological and industrial strengths with a high-quality digital infrastructure and a regulatory framework based on its fundamental values to become a global leader in innovation in the data economy and its applications as set out in the European data strategy.

On that basis, it can develop an AI ecosystem that brings the benefits of the technology to the whole of European society and economy

-> EU의 기술적 산업적 강점과 높은 수준의 디지털 인프라를 결합하고

    유럽이 Global Leader가 되고자 하는 "규제 Framework"를 통해 EU AI 생태계를 만들것이라는 것이 핵심

    여기서 가장 중요한 부분은 규제 Framework인데 EU는 GDPR에서 보았지만 항상 규제를 통한 안전성을 중점으로 두고 있음

    EU 내 AI산업도 GDPR과 같이 안전성, 신뢰성을 기반이 되는 구체적 규제가 나올 것으로 예상

 

 

[2. CAPITALISING ON STRENGTHS IN INDUSTRIAL AND PROFESSIONAL MARKETS]

In response, Europe needs to increase its investment levels significantly. The Coordinated plan on AI developed with Member States is proving to be a good starting point in building closer cooperation on AI in Europe and in creating synergies to maximise investment in the AI value chain.

-> EU에서 AI 투자를 증대시킬 것이기 때문에

    EU 내 AI산업은 생태계와 가치 사슬의 형성에서 좋은 시작점일 것임

 

 

[3. SEIZING THE OPPORTUNITIES AHEAD: THE NEXT DATA WAVE]

The volume of data produced in the world is growing rapidly, from 33 zettabytes in 2018 to an expected 175 zettabytes in 2025. Each new wave of data brings opportunities for Europe to position itself in the data-agile economy and to become a world leader in this area.

-> 지속적으로 증가하는 데이터의 양은 EU에게 데이터 경제의 리더가 되게 할 것.

    내용 전체에 나오는 AI에 필수적인 저전력 전자, 양자컴퓨팅 등에서 강점을 가지고 있으며

    이런 산업들을 기반으로 연계해 AI 시대의 리더가 될 것

 

[4. AN ECOSYSTEM OF EXCELLENCE]

  [A.WORKING WITH MEMBER STATES]

  EU-level funding in AI should attract and pool investment in areas where the action required goes

  beyond what any single Member State can achieve

  -> 단일 국가가 아닌 EU 레벨에서의 AI 산업을 위한 자금 유치 진행

  

  [B. FOCUSING THE EFFORTS OF THE RESEARCH AND INNOVATION COMMUNITY]

  Europe cannot afford to maintain the current fragmented landscape of centres of competence with

  none reaching the scale necessary to compete with the leading institutes globally.

  -> 세계 리딩 기업과의 경쟁을 위해 단편화된 센터를 유지하지 말고 조정 및 네트워킹 할 필요성이 존재

 

  The centres and the networks should concentrate in sectors where Europe has the potential to

  become a global champion such as industry, health, transport, finance, agrifood value chains,

  energy/environment, forestry, earth observation and space.

  -> AI 센터들은 강점이 있는 산업, 건강, 운송, 금융, 농식품, 에너지, 환경, 임업 등에 집중할 필요가 있음.

 

  [C. SKILLS]

  Developing the skills necessary to work in AI and upskilling the workforce to become fit for the 

  AI-led transformation will be a priority of the revised Coordinated Plan on AI to be developed

  with Member States.

  -> AI 교육이 조정되는 계획에서 우선이 될것

 

  [D. FOCUS ON SMES]

  It will also be important to ensure that SMEs can access and use AI. To this end, the Digital Innovation

  Hubs and the AI-on-demand platform should be strengthened further and foster collaboration

  between SMEs.

  -> 중소기업 또한 AI에 접근이 가능하도록 지원을 해주는 것이 핵심

      Digital Innovation Hubs, AI-on-demand platform 등을 통해서 지원

  

  [E. PARTNERSHIP WITH THE PRIVATE SECTOR]

  It is also essential to make sure that the private sector is fully involved in setting the research and

  innovation agenda and provides the necessary level of co-investment

  -> 민간 부문이 연구 및 혁신 의제 설정에 전적으로 참여, 필요한 공동 투자 수준을 제공하는 것이 필수.

 

  [F. PROMOTING THE ADOPTION OF AI BY THE PUBLIC SECTOR]

  It is essential that public administrations, hospitals, utility and transport services, financial supervisors,

  and other areas of public interest rapidly begin to deploy products and services that rely on AI in their

  activities.

  -> 공공 부문의 산업에 AI를 빠르게 적용하는 것이 필수.

 

  [G. SECURING ACCESS TO DATA AND COMPUTING INFRASTRUCTURES]

  Promoting responsible data management practices and compliance of data with the FAIR principles

  will contribute to build trust and ensure re-usability of data.

  -> 책임있는 데이터 관리, 공정성에 기반한 데이터 준수를 통해 데이터 보안을 확보

 

  [H. INTERNATIONAL ASPECTS]

  The EU will continue to cooperate with like-minded countries, but also with global players, on AI,

  based on an approach based on EU rules and values (e.g. supporting upward regulatory convergence,

  accessing key resources including data, creating a level playing field)

  -> EU 규칙 및 가치에 기반한 접근 방식으로 다른 국가들과 협력하겠다는 의미

 

[5. AN ECOSYSTEM OF TRUST: REGULATORY FRAMEWORK FOR AI]

  [A. PROBLEM DEFINITION]

   A regulatory framework should concentrate on how to minimise the various risks of potential harm,

   in particular the most significant ones. The main risks related to the use of AI concern the application

   of rules designed to protect fundamental rights

   -> 규제 Framework는 잠재적인 위험을 최소화 하기 위해 집중해야할 필요

 

  [B. POSSIBLE ADJUSTMENTS TO EXISTING EU LEGISLATIVE FRAMEWORK RELATING TO AI]

   While the EU legislation remains in principle fully applicable irrespective of the involvement of AI,

   it is important to assess whether it can be enforced adequately to address the risks that AI systems

   create, or whether adjustments are needed to specific legal instrumentsFor example, economic actors

   remain fully responsible for the compliance of AI to existing rules that protects consumers, any

   algorithmic exploitation of consumer behaviour in violation of existing rules shall be not permitted

   and violations shall be accordingly punished.

   ->  AI 관련과 관계없이 EU 법규는 원칙적으로 완전히 적용 가능한 상태로 유지

        AI가 생성하는 위험을 해결하기 위해 적절하게 시행 될 수 있는지 또는 특정 법적 수단에 조정이 필요한지

        여부는 평가하는 것이 중요

 

  [C. SCOPE OF A FUTURE EU REGULATORY FRAMEWORK]

   The working assumption is that the regulatory framework would apply to products and services

   relying on AI. AI should therefore be clearly defined for the purposes of this White Paper,

   as well as any possible future policy-making initiative.

   -> 규제 Framework가 AI에 의존하는 제품 및 서비스에 적용.

       따라서 AI는 EU AI 백서의 목적과 미래의 모든 정책 결정 이니셔티브를 위해 명확하게 정의

 

[6. CONCLUSION]

   The European approach for AI aims to promote Europe’s innovation capacity in the area of AI while 

   supporting the development and uptake of ethical and trustworthy AI across the EU economy.

   AI should work for people and be a force for good in society.

   -> AI 대한 EU 접근 방식은 윤리적이고 신뢰할 수있는 AI 개발 채택을 지원

       AI 영역에서 럽의 혁신 역량을 증진시키는 것을 목표.

 

'AI' 카테고리의 다른 글

TensorFlow 1.x vs 2.x버전 MNIST학습 데이터 import 차이  (0) 2020.07.12

+ Recent posts