范文健康探索娱乐情感热点
投稿投诉
热点动态
科技财经
情感日志
励志美文
娱乐时尚
游戏搞笑
探索旅游
历史星座
健康养生
美丽育儿
范文作文
教案论文
国学影视

你肯定想学习的顶级Python项目(附代码)

  作者:Anirudh Rao
  翻译:张睿毅
  校对:王婷
  本文约4600字,建议阅读20分钟。
  本文介绍了三种不同的阶段去开发Python项目,旨在提供适合各种难度层次Python项目。
  Python项目–Python的初级、中级和高级
  在这个"Python 项目"博客中,让我们来看3个级别的Python项目,通过这三个项目您将会学习掌握Python,以及从整体上测试项目的分析、开发和处理问题的技能。
  如果我说Python的学习真的很有趣,很多人都会同意的。
  我们先浏览下面的主题列表,之后开始阅读这篇Python项目博客:Python简介如何学习Python项目?初级Python项目:用Python玩汉格曼游戏中级Python项目:在Python中使用图形高级Python项目:使用Python进行机器学习结论
  我应当先向您简单介绍一下Python。
  Python简介
  Python是一种高级的、面向对象的、解释性的编程语言。它在世界上享有广泛关注。Stack Overflow发现38.8%的用户主要使用Python来完成项目。
  Python是由一个名为Guido Van Rossum的开发人员创建的。
  Python是而且一直是很容易学习和掌握的。它对初学者非常友好,语法非常简单,易于阅读和理解。这特别让我们高兴,而令人更高兴的是Python在全球拥有数百万快乐的学习者!
  根据该网站的调查,在2018年,Python的人气超过了c#,就像它在2017年超过了php一样。在GitHub平台上,Python超越了Java成为第二个最常用的编程语言,在2017中比2016多获得了40%的申请。
  这使得Python认证成为最受欢迎的编程认证之一。
  如何学习Python项目?
  答案相当简单直接:从学习Python的初级知识和所有基本知识开始。这是一个用于了解您使用Python舒适程度的评价指标。
  下一个主要步骤是看一看基本、简单的代码,以熟悉代码中的语法和逻辑流。这是一个非常重要的步骤,有助于为以后的工作打下坚实的基础。
  在这之后,您还要看看在现实生活中Python如何使用。这将成为您在开始就要学习Python的主要原因。
  如果您不是刚入门Python,那么您将会学习Python项目,并对自己的项目实施一些策略。接下来一定要看看您可以利用当前关于Python的知识进行处理哪些项目。深入研究Python会帮助您在各个阶段评估自己。
  项目基本上是用来解决眼下问题的。如果为各种简单或复杂的问题提供解决方案是您的特长,那么您一定要考虑学习Python的项目。
  每当着手搞定几个项目之后,您距离掌握Python将更近一步。这一点很重要,因为这样您就能够自然地将所学的知识应用到项目中,从简单的程序如计算器,到辅助实现人工智能的学习。
  让我们从第一级的Python项目开始学习。https://www.edureka.co/Python-programming-certification-training
  初级Python项目:用Python实现《Hangman》游戏
  我们能想到的最好的入门项目是《Hangman》游戏。我敢肯定读过这篇Python项目博客的大多数人都曾在生活中某个时刻玩过《Hangman》。用一句话来解释,它的主要目标是创建一个"猜词"游戏。尽管听起来很简单,但有一些关键的东西需要注意。需要用户能够输入猜测的字母。需要限制他们的猜测次数。需要不停地告知用户剩余圈数。
  这意味着你需要一种方法来获取一个用于猜测的单词。让我们用简单思维,使用文本文件输入。文本文件包含了我们必须猜测的单词。
  您还需要一些函数去检查用户是否实际输入了单个字母,检查输入的字母是否出现在单词中(如果是,则检查出现多少次),以及打印字母;还有一个计数器变量限制猜测的次数。
  这个Python项目中有一些关键的概念需要牢记:随机变量布尔值输入和输出整形值字符型值字符串字符串长度打印
  代码:
  1. Hangman.pyfrom string import ascii_lowercase
  from words import get_random_word
  def get_num_attempts():
  """Get user-inputted number of incorrect attempts for the game."""
  while True:
  num_attempts = input(
  "How many incorrect attempts do you want? [1-25] ")
  try:
  num_attempts = int(num_attempts)
  if 1 <= num_attempts <= 25:
  return num_attempts
  else:
  print("{0} is not between 1 and 25".format(num_attempts))
  except ValueError:
  print("{0} is not an integer between 1 and 25".format(
  num_attempts))
  def get_min_word_length():
  """Get user-inputted minimum word length for the game."""
  while True:
  min_word_length = input(
  "What minimum word length do you want? [4-16] ")
  try:
  min_word_length = int(min_word_length)
  if 4 <= min_word_length <= 16: return min_word_length else: print("{0} is not between 4 and 16".format(min_word_length)) except ValueError: print("{0} is not an integer between 4 and 16".format( min_word_length)) def get_display_word(word, idxs): """Get the word suitable for display.""" if len(word) != len(idxs): raise ValueError("Word length and indices length are not the same") displayed_word = "".join( [letter if idxs[i] else "*" for i, letter in enumerate(word)]) return displayed_word.strip() def get_next_letter(remaining_letters): """Get the user-inputted next letter.""" if len(remaining_letters) == 0: raise ValueError("There are no remaining letters") while True: next_letter = input("Choose the next letter: ").lower() if len(next_letter) != 1: print("{0} is not a single character".format(next_letter)) elif next_letter not in ascii_lowercase: print("{0} is not a letter".format(next_letter)) elif next_letter not in remaining_letters: print("{0} has been guessed before".format(next_letter)) else: remaining_letters.remove(next_letter) return next_letter def play_hangman(): """Play a game of hangman. At the end of the game, returns if the player wants to retry. """ # Let player specify difficulty print("Starting a game of Hangman...") attempts_remaining = get_num_attempts() min_word_length = get_min_word_length() # Randomly select a word print("Selecting a word...") word = get_random_word(min_word_length) print() # Initialize game state variables idxs = [letter not in ascii_lowercase for letter in word] remaining_letters = set(ascii_lowercase) wrong_letters = [] word_solved = False # Main game loop while attempts_remaining > 0 and not word_solved:
  # Print current game state
  print("Word: {0}".format(get_display_word(word, idxs)))
  print("Attempts Remaining: {0}".format(attempts_remaining))
  print("Previous Guesses: {0}".format(" ".join(wrong_letters)))
  # Get player"s next letter guess
  next_letter = get_next_letter(remaining_letters)
  # Check if letter guess is in word
  if next_letter in word:
  # Guessed correctly
  print("{0} is in the word!".format(next_letter))
  # Reveal matching letters
  for i in range(len(word)):
  if word[i] == next_letter:
  idxs[i] = True
  else:
  # Guessed incorrectly
  print("{0} is NOT in the word!".format(next_letter))
  # Decrement num of attempts left and append guess to wrong guesses
  attempts_remaining -= 1
  wrong_letters.append(next_letter)
  # Check if word is completely solved
  if False not in idxs:
  word_solved = True
  print()
  # The game is over: reveal the word
  print("The word is {0}".format(word))
  # Notify player of victory or defeat
  if word_solved:
  print("Congratulations! You won!")
  else:
  print("Try again next time!")
  # Ask player if he/she wants to try again
  try_again = input("Would you like to try again? [y/Y] ")
  return try_again.lower() == "y"
  if __name__ == "__main__":
  while play_hangman():
  print()
  2.Words.py"""Function to fetch words."""
  import random
  WORDLIST = "wordlist.txt"
  def get_random_word(min_word_length):
  """Get a random word from the wordlist using no extra memory."""
  num_words_processed = 0
  curr_word = None
  with open(WORDLIST, "r") as f:
  for word in f:
  if "(" in word or ")" in word:
  continue
  word = word.strip().lower()
  if len(word) < min_word_length:
  continue
  num_words_processed += 1
  if random.randint(1, num_words_processed) == 1:
  curr_word = word
  return curr_word
  结果如图
  现在我们已经了解了如何处理像《hangman》这样的初级项目,那么让我们稍微升级一下,尝试一个中级的Python项目。
  中级Python项目:在Python中使用图形
  开始学习Python编程的中间阶段的最好方法绝对是开始使用Python支持的库。
  在用Python进行编码时,可以使用真正意义上的"n"个库。有些库是非常容易直接的,而有些可能需要一些时间来理解和掌握。
  下面是一些您可以考虑入门学习的顶级库:NumPySciPyPandasMatplotlib
  NumPy总的来说是用于科学计算的。
  SciPy使用数组,例如用于线性代数、微积分和其他类似概念的基本数据结构。
  Pandas用于数据帧,而Matplotlib则以图形和符号的形式显示数据。
  实现数据可视化可能是Python最好的应用之一。尽管数字化的数据输出很有用,但对数据的可视化表示也有许多要求。
  它通过可视化展现,只是一种抽象概括。从创建前端或图形用户界面(GUI)到将数字化数据绘制为图上的点。
  Matplotlib用于在图形上绘制数据点。Matplotlib是一个绘图库,可以用于Python编程语言及其数字化数学扩展库NumPy。它提供了一个面向对象的API,通过使用通用的GUI工具包(如Tkinter、wxPython、Qy或GTK+),将绘图嵌入到应用中。
  在Python中有许多用于三维绘图的选项,但这里有一些使用Matplotlib的常见简单方法。
  一般来说,第一步是创建一个三维坐标轴,然后绘制出最能说明特定需求的数据的三维图形。为了使用Matplotlib,必须导入Matplotlib安装中包含的mplot3d工具包:from mpl_toolkits import mplot3d
  然后,要创建三维轴,可以执行以下代码:<pre id="3346" class="graf graf--pre graf-after--p">%matplotlib inline
  import numpy as np
  import matplotlib.pyplot as plt
  fig = plt.figure()
  ax = plt.axes(projection=’3d’)</pre>
  在这个三维坐标轴中,可以绘制一个图,重要的是要知道哪种类型的图(或图的组合)可以更好地描述数据。
  此时,您需要注意的是,这一操作是我们进一步绘图的基础。https://www.edureka.co/Python-programming-certification-training
  点和线:
  下图结合了两个绘图,一个图带有一条线,该线穿过数据的每个点,另一个图在本例中的每个特定1000个值上绘制一个点。
  这个代码分析时实际上非常简单。我们利用标准三角函数绘制了一组随机值,并利用这些数据生成三维投影。
  代码:ax = plt.axes(projection=’3d’)# Data for a three-dimensional line
  zline = np.linspace(0, 15, 1000)
  xline = np.sin(zline)
  yline = np.cos(zline)
  ax.plot3D(xline, yline, zline, ‘gray’)# Data for three-dimensional scattered points
  zdata = 15 * np.random.random(100)
  xdata = np.sin(zdata) + 0.1 * np.random.randn(100)
  ydata = np.cos(zdata) + 0.1 * np.random.randn(100)
  ax.scatter3D(xdata, ydata, zdata, c=zdata, cmap=’Greens’);
  三维等高线图
  由于需要二维网格上的数据,因此轮廓图的输入与上一个绘图稍有不同。
  请注意,在下面的示例中,在为x和y赋值之后,通过执行"np.meshgrid(x,y)"将它们组合到网格上,然后通过执行函数f(x,y)和网格值(z=f(x,y))创建z值。
  再一次,基本的简化三维图为以下代码:def f(x, y):
  return np.sin(np.sqrt(x ** 2 + y ** 2))
  x = np.linspace(-6, 6, 30)
  y = np.linspace(-6, 6, 30)
  X, Y = np.meshgrid(x, y)
  Z = f(X, Y)fig = plt.figure()
  ax = plt.axes(projection="3d")
  ax.contour3D(X, Y, Z, 50, cmap="binary")
  ax.set_xlabel("x")
  ax.set_ylabel("y")
  ax.set_zlabel("z");
  在以前的图形中,数据是按顺序生成的,但在现实生活中,有时数据是不按顺序生成的,对于这些情况,三角网格曲面测量非常有用,因为它通过查找相邻点之间形成的三角形集来创建曲面。
  表面三角测量:theta = 2 * np.pi * np.random.random(1000)
  r = 6 * np.random.random(1000)
  x = np.ravel(r * np.sin(theta))
  y = np.ravel(r * np.cos(theta))
  z = f(x, y)
  ax = plt.axes(projection=’3d’)
  ax.plot_trisurf(x, y, z,cmap=’viridis’, edgecolor=’none’);
  现在我们已经熟悉了如何通过查看外部库来扩展我们对Python的学习,那么我们就可以研究下一个高级级别的Python项目。
  Python 高级项目
  Python有着广泛的应用——从"Hello World"一路走到实现人工智能。
  实际上,您可以使用Python进行无限多的项目,但如果您想深入了解Python的核心,可以考虑以下几个主要的项目。使用PyTorch、TensorFlow、Keras和您喜欢的任何机器学习库进行机器学习。使用OpenCV和PIL研究计算机视觉。使用测试和文档,创建和发布自己的pip模块。
  在这些里面,我最喜欢的就是机器学习和深度学习。让我们看一个非常好的用例以便深入学习Python。
  在Python中使用TensorFlow实现CIFAR10
  让我们训练一个网络,对CIFAR10数据集中的图像进行分类。可以使用TensorFlow内置的卷积神经网络。
  为理解用例的工作原理,我们考虑以下流程图:
  我们把这个流程图分解成简单的组分:首先将图像加载到程序中这些图像存储在程序可以访问的位置将数据规范化,因为我们需要Python来理解当前的信息。定义神经网络的基础。定义损失函数以确保我们在数据集上获得最大精度训练实际模型,了解一些它所一直看到的数据对模型进行测试,以分析其准确性,并迭代整个训练过程,以获得更好的精度。
  这个用例分为两个程序。一个是训练网络,另一个是测试网络。
  我们先训练一下这个网络。
  训练网络import numpy as np
  import tensorflow as tf
  from time import time
  import math
  from include.data import get_data_set
  from include.model import model, lr
  train_x, train_y = get_data_set("train")
  test_x, test_y = get_data_set("test")
  tf.set_random_seed(21)
  x, y, output, y_pred_cls, global_step, learning_rate = model()
  global_accuracy = 0
  epoch_start = 0
  # PARAMS
  _BATCH_SIZE = 128
  _EPOCH = 60
  _SAVE_PATH = "./tensorboard/cifar-10-v1.0.0/"
  # LOSS AND OPTIMIZER
  loss = tf.reduce_mean(tf.nn.softmax_cross_entropy_with_logits_v2(logits=output, labels=y))
  optimizer = tf.train.AdamOptimizer(learning_rate=learning_rate,
  beta1=0.9,
  beta2=0.999,
  epsilon=1e-08).minimize(loss, global_step=global_step)
  # PREDICTION AND ACCURACY CALCULATION
  correct_prediction = tf.equal(y_pred_cls, tf.argmax(y, axis=1))
  accuracy = tf.reduce_mean(tf.cast(correct_prediction, tf.float32))
  # SAVER
  merged = tf.summary.merge_all()
  saver = tf.train.Saver()
  sess = tf.Session()
  train_writer = tf.summary.FileWriter(_SAVE_PATH, sess.graph)
  try:
  print("\nTrying to restore last checkpoint ...")
  last_chk_path = tf.train.latest_checkpoint(checkpoint_dir=_SAVE_PATH)
  saver.restore(sess, save_path=last_chk_path)
  print("Restored checkpoint from:", last_chk_path)
  except ValueError:
  print("\nFailed to restore checkpoint. Initializing variables instead.")
  sess.run(tf.global_variables_initializer())
  def train(epoch):
  global epoch_start
  epoch_start = time()
  batch_size = int(math.ceil(len(train_x) / _BATCH_SIZE))
  i_global = 0
  for s in range(batch_size):
  batch_xs = train_x[s*_BATCH_SIZE: (s+1)*_BATCH_SIZE]
  batch_ys = train_y[s*_BATCH_SIZE: (s+1)*_BATCH_SIZE]
  start_time = time()
  i_global, _, batch_loss, batch_acc = sess.run(
  [global_step, optimizer, loss, accuracy],
  feed_dict={x: batch_xs, y: batch_ys, learning_rate: lr(epoch)})
  duration = time() - start_time
  if s % 10 == 0:
  percentage = int(round((s/batch_size)*100))
  bar_len = 29
  filled_len = int((bar_len*int(percentage))/100)
  bar = "=" * filled_len + ">" + "-" * (bar_len - filled_len)
  msg = "Global step: {:>5} - [{}] {:>3}% - acc: {:.4f} - loss: {:.4f} - {:.1f} sample/sec"
  print(msg.format(i_global, bar, percentage, batch_acc, batch_loss, _BATCH_SIZE / duration))
  test_and_save(i_global, epoch)
  def test_and_save(_global_step, epoch):
  global global_accuracy
  global epoch_start
  i = 0
  predicted_class = np.zeros(shape=len(test_x), dtype=np.int)
  while i < len(test_x): j = min(i + _BATCH_SIZE, len(test_x)) batch_xs = test_x[i:j, :] batch_ys = test_y[i:j, :] predicted_class[i:j] = sess.run( y_pred_cls, feed_dict={x: batch_xs, y: batch_ys, learning_rate: lr(epoch)} ) i = j correct = (np.argmax(test_y, axis=1) == predicted_class) acc = correct.mean()*100 correct_numbers = correct.sum() hours, rem = pmod(time() - epoch_start, 3600) minutes, seconds = pmod(rem, 60) mes = "\nEpoch {} - accuracy: {:.2f}% ({}/{}) - time: {:0>2}:{:0>2}:{:05.2f}"
  print(mes.format((epoch+1), acc, correct_numbers, len(test_x), int(hours), int(minutes), seconds))
  if global_accuracy != 0 and global_accuracy < acc: summary = tf.Summary(value=[ tf.Summary.Value(tag="Accuracy/test", simple_value=acc), ]) train_writer.add_summary(summary, _global_step) saver.save(sess, save_path=_SAVE_PATH, global_step=_global_step) mes = "This epoch receive better accuracy: {:.2f} > {:.2f}. Saving session..."
  print(mes.format(acc, global_accuracy))
  global_accuracy = acc
  elif global_accuracy == 0:
  global_accuracy = acc
  print("###########################################################################################################")
  def main():
  train_start = time()
  for i in range(_EPOCH):
  print("\nEpoch: {}/{}\n".format((i+1), _EPOCH))
  train(i)
  hours, rem = pmod(time() - train_start, 3600)
  minutes, seconds = pmod(rem, 60)
  mes = "Best accuracy pre session: {:.2f}, time: {:0>2}:{:0>2}:{:05.2f}"
  print(mes.format(global_accuracy, int(hours), int(minutes), seconds))
  if __name__ == "__main__":
  main()
  sess.close()
  输出:
  Epoch: 60/60
  Global step: 23070 - [>-----------------------------] 0% - acc: 0.9531 - loss: 1.5081 - 7045.4 sample/sec
  Global step: 23080 - [>-----------------------------] 3% - acc: 0.9453 - loss: 1.5159 - 7147.6 sample/sec
  Global step: 23090 - [=>----------------------------] 5% - acc: 0.9844 - loss: 1.4764 - 7154.6 sample/sec
  Global step: 23100 - [==>---------------------------] 8% - acc: 0.9297 - loss: 1.5307 - 7104.4 sample/sec
  Global step: 23110 - [==>---------------------------] 10% - acc: 0.9141 - loss: 1.5462 - 7091.4 sample/sec
  Global step: 23120 - [===>--------------------------] 13% - acc: 0.9297 - loss: 1.5314 - 7162.9 sample/sec
  Global step: 23130 - [====>-------------------------] 15% - acc: 0.9297 - loss: 1.5307 - 7174.8 sample/sec
  Global step: 23140 - [=====>------------------------] 18% - acc: 0.9375 - loss: 1.5231 - 7140.0 sample/sec
  Global step: 23150 - [=====>------------------------] 20% - acc: 0.9297 - loss: 1.5301 - 7152.8 sample/sec
  Global step: 23160 - [======>-----------------------] 23% - acc: 0.9531 - loss: 1.5080 - 7112.3 sample/sec
  Global step: 23170 - [=======>----------------------] 26% - acc: 0.9609 - loss: 1.5000 - 7154.0 sample/sec
  Global step: 23180 - [========>---------------------] 28% - acc: 0.9531 - loss: 1.5074 - 6862.2 sample/sec
  Global step: 23190 - [========>---------------------] 31% - acc: 0.9609 - loss: 1.4993 - 7134.5 sample/sec
  Global step: 23200 - [=========>--------------------] 33% - acc: 0.9609 - loss: 1.4995 - 7166.0 sample/sec
  Global step: 23210 - [==========>-------------------] 36% - acc: 0.9375 - loss: 1.5231 - 7116.7 sample/sec
  Global step: 23220 - [===========>------------------] 38% - acc: 0.9453 - loss: 1.5153 - 7134.1 sample/sec
  Global step: 23230 - [===========>------------------] 41% - acc: 0.9375 - loss: 1.5233 - 7074.5 sample/sec
  Global step: 23240 - [============>-----------------] 43% - acc: 0.9219 - loss: 1.5387 - 7176.9 sample/sec
  Global step: 23250 - [=============>----------------] 46% - acc: 0.8828 - loss: 1.5769 - 7144.1 sample/sec
  Global step: 23260 - [==============>---------------] 49% - acc: 0.9219 - loss: 1.5383 - 7059.7 sample/sec
  Global step: 23270 - [==============>---------------] 51% - acc: 0.8984 - loss: 1.5618 - 6638.6 sample/sec
  Global step: 23280 - [===============>--------------] 54% - acc: 0.9453 - loss: 1.5151 - 7035.7 sample/sec
  Global step: 23290 - [================>-------------] 56% -acc: 0.9609 - loss: 1.4996 - 7129.0 sample/sec
  Global step: 23300 - [=================>------------] 59% - acc: 0.9609 - loss: 1.4997 - 7075.4 sample/sec
  Global step: 23310 - [=================>------------] 61% - acc: 0.8750 - loss: 1.5842 - 7117.8 sample/sec
  Global step: 23320 - [==================>-----------] 64% - acc: 0.9141 - loss: 1.5463 - 7157.2 sample/sec
  Global step: 23330 - [===================>----------] 66% - acc:0.9062 - loss: 1.5549 - 7169.3 sample/sec
  Global step: 23340 - [====================>---------] 69% - acc: 0.9219 - loss: 1.5389 - 7164.4 sample/sec
  Global step: 23350 - [====================>---------] 72% - acc: 0.9609 - loss: 1.5002 - 7135.4 sample/sec
  Global step: 23360 - [=====================>--------] 74% - acc: 0.9766 - loss: 1.4842 - 7124.2 sample/sec
  Global step: 23370 - [======================>-------] 77% - acc: 0.9375 - loss: 1.5231 - 7168.5 sample/sec
  Global step: 23380 - [======================>-------] 79% - acc: 0.8906 - loss: 1.5695 - 7175.2 sample/sec
  Global step: 23390 - [=======================>------] 82% - acc: 0.9375 - loss: 1.5225 - 7132.1 sample/sec
  Global step: 23400 - [========================>-----] 84% - acc: 0.9844 - loss: 1.4768 - 7100.1 sample/sec
  Global step: 23410 - [=========================>----] 87% - acc: 0.9766 - loss: 1.4840 - 7172.0 sample/sec
  Global step: 23420 - [==========================>---] 90% - acc: 0.9062 - loss: 1.5542 - 7122.1 sample/sec
  Global step: 23430 - [==========================>---] 92% - acc:0.9297 - loss: 1.5313 - 7145.3 sample/sec
  Global step: 23440 - [===========================>--] 95% - acc: 0.9297 - loss: 1.5301 - 7133.3 sample/sec
  Global step: 23450 - [============================>-] 97% - acc: 0.9375 - loss: 1.5231 - 7135.7 sample/sec
  Global step: 23460 - [=============================>] 100% - acc: 0.9250 - loss: 1.5362 - 10297.5 sample/sec
  Epoch 60 - accuracy: 78.81% (7881/10000)
  This epoch receive better accuracy: 78.81 > 78.78. Saving session...
  在测试数据集上运行网络import numpy as np
  import tensorflow as tf
  from include.data import get_data_set
  from include.model import model
  test_x, test_y = get_data_set("test")
  x, y, output, y_pred_cls, global_step, learning_rate = model()
  _BATCH_SIZE = 128
  _CLASS_SIZE = 10
  _SAVE_PATH = "./tensorboard/cifar-10-v1.0.0/"
  saver = tf.train.Saver()
  sess = tf.Session()
  try:
  print("\nTrying to restore last checkpoint ...")
  last_chk_path = tf.train.latest_checkpoint(checkpoint_dir=_SAVE_PATH)
  saver.restore(sess, save_path=last_chk_path)
  print("Restored checkpoint from:", last_chk_path)
  except ValueError:
  print("\nFailed to restore checkpoint. Initializing variables instead.")
  sess.run(tf.global_variables_initializer())
  def main():
  i = 0
  predicted_class = np.zeros(shape=len(test_x), dtype=np.int)
  while i < len(test_x):
  j = min(i + _BATCH_SIZE, len(test_x))
  batch_xs = test_x[i:j, :]
  batch_ys = test_y[i:j, :]
  predicted_class[i:j] = sess.run(y_pred_cls, feed_dict={x: batch_xs, y: batch_ys})
  i = j
  correct = (np.argmax(test_y, axis=1) == predicted_class)
  acc = correct.mean() * 100
  correct_numbers = correct.sum()
  print()
  print("Accuracy on Test-Set: {0:.2f}% ({1} / {2})".format(acc, correct_numbers, len(test_x)))
  if __name__ == "__main__":
  main()
  sess.close()
  简单输出:Trying to restore last checkpoint ...
  Restored checkpoint from: ./tensorboard/cifar-10-v1.0.0/-23460
  Accuracy on Test-Set: 78.81% (7881 / 10000)
  这难道不是一个非常有趣的用例吗?至此,我们了解了机器学习是如何工作的,开发了一个基本程序,并使用Python中的TensorFlow来实现了它。
  原文标题:Top Python Projects You Should Consider Learning
  原文链接:https://www.edureka.co/blog/python-projects/
  编辑:王菁
  校对:龚力
  译者简介
  张睿毅,北京邮电大学大二物联网在读。我是一个爱自由的人。在邮电大学读第一年书我就四处跑去蹭课,折腾整一年惊觉,与其在当下焦虑,不如在前辈中沉淀。于是在大二以来,坚持读书,不敢稍歇。资本主义国家的科学观不断刷新我的认知框架,同时因为出国考试很早出分,也更早地感受到自己才是那个一直被束缚着的人。太多真英雄在社会上各自闪耀着光芒。这才开始,立志终身向遇到的每一个人学习。做一个纯粹的计算机科学里面的小学生。喜欢算法,数据挖掘,图像识别,自然语言处理,神经网络,人工智能等方向。
  — 完 —
  关注清华-青岛数据科学研究院官方微信公众平台"THU数据派"及姊妹号"数据派THU"获取更多讲座福利及优质内容。

科大讯飞智能办公本Air发布C端业务持续发力5月23日,科大讯飞(002230)举办2022年智能办公本新品发布会,全新出品的智能办公本Air正式亮相。从技术中来,到产品中去。科大讯飞要有真正原创的技术突破来支撑产品创新,同比亚迪海豹搭载黑科技CTB技术特斯拉颤抖CTB全面突破比亚迪海豹预售亮眼海豹采用铁锂刀片电池,100km加速最快达3。8s,100km电耗低至12。6KWh,续航550650700km,带电量61。482。5KWh,快充仿蜘蛛丝纤维,使海水淡化变得超级有利可图雨后,我们常常发现角落里的蜘蛛网上悬挂着一颗颗水滴。研究发现,这是蜘蛛丝独特的纤维结构产生的集水现象。自然界中,多数生物为了获取赖以生存的淡水,都进化出了凭空取水的能力,比如刚才提中国造全球首艘智能型无人系统母船下水,未来有何重大战略价值?全球首艘智能无人系统母船正式下水5月18日,也就是昨天,全球首艘智能型无人系统母船珠海云号在广州下水。该船隶属于我国南方海洋科学与工程广东省实验室(珠海),是智能敏捷海洋立体观测系关爱银发族中国移动北京公司推出多项适老化举措近日,中国移动服务采访活动在线上举行,此次活动通过云视讯实现了北京会场与苏州会场杭州会场的实时连线,中国移动有关负责人线上出席,并通过视频连线的方式回答记者提问。据悉,为了更好的为纯国产无人系统母船下水,世界领先我们正处在战争性质的根本性质转变之中。美军参谋长马克米利曾说过这样一段话。他认为美如果要保持对咱们的战斗优势,就必须全面拥抱机器人和人工智能,未来全球的局势会发生根本性的变化!而在差点自闭!京东面试官夺命连环问操作系统,幸好最后拿到了offer为什么一定要学计算机操作系统啊?因为不打好计算机基础功底,上来就直接学javaAndroid等应用课程的话,你就相当于到一个陌生城市旅游的观光者,只能看到各种高楼大厦的外表。如果你还厨房清净自在,妈妈说云米Flash2烟灶套装太好用了家里的油烟机年头有点久了,爆炒的时候还会时不时呛着母亲,十分的心疼。经过精挑细选和向朋友询问,最后决定连燃气灶一起换掉,直接整一套新的抽油烟机灶具套装,购买了这套云米Flash2烟苹果公司摊上事儿了据路透社布鲁塞尔2日报道,欧盟反垄断监管机构2日指责苹果公司限制竞争对手使用其芯片技术,苹果公司从而可能面临高额罚款,并有可能被迫向竞争对手开放移动支付系统。报道称,该机构向苹果公华米科技联合北大第一医院发布血压筛查项目,Amazfit跃我GTR3Pro首批搭载11月22日,智能可穿戴和健康云服务公司华米科技(NYSEZEPP)宣布,旗下智能手表Amazfit跃我GTR3Pro正式上线血压筛查研究项目。该项目由国内知名三甲医院北京大学第一助听器佩戴后对听神经有刺激作用,听力是否会提升?您好,助听器是帮助有听力损失人群听得更好的一种电子设备,本身作用是不能够提升听力的,但是长时间佩戴验配好的全数字助听器对大脑和听觉系统有一定的刺激作用,对比之前的听力数据可能会上升
视频分析技术的三大新兴趋势人工智能跟踪人脸微表情在最近的一篇博客中,我们看到了视频分析如何成为提供更好城市监控的有用解决方案。在这里,我们将更详细地阐述视频分析的技术能力。市场规模预计将从2016年的16。9亿美元增长到20212022年5个值得关注的AI趋势,一分钟看明白根据2020年麦肯锡全球人工智能(AI)调查,2020年,超过50的公司已经在至少一个业务部门或职能部门采用了人工智能,因此我们见证了新的人工智能趋势的出现。科技公司将至少20的利三星QDOLED电视来了2022年CES发布QLED显示技术虽然在高端市场拥有不错的市场占有率,但从技术原理来看,现阶段依旧是光质发光(需要背光源),而OLED天然就是自发光,画质和形态上的潜力巨大。此前,三星官方已确认将于蓝色巨人IBM大象转身业务自我分拆的断舍离2020年的10月8日,蓝色巨人IBM宣布将在2021年底之前,剥离全球科技服务业务中的基础设施服务托管部门,并组建一家新公司NewCo。NewCo将专注于企业基础设施管理和现代化炒股巨亏后又见资本运作!云南白药要约收购万隆控股财联社(上海,编辑周新旸)讯,在三季度爆出因炒股而蒙受15。6亿元浮亏后,云南白药近期已遭到投资者颇多批评。但该公司周四稍晚又对外公布一项收购计划,拟对一家港股公司发起要约收购。1从阿亚冲突的无人机打坦克,看未来战争格局国庆假期国外最大的新闻,一个是川普得了新冠,博了全球媒体的眼球,其实更让人深思的是亚美尼亚和阿斯拜疆的领土争端引起的战争,从阿斯拜疆公布的视频中,可以看到,亚美尼亚的坦克和炮兵在被对标大疆索尼首款无人机问世还记得去年11月索尼公司启动的Airpeak人工智能无人机项目吗?今天它来了。今日,索尼在CES2021展会上,推出其首款无人机航拍设备Airpeak,借此索尼正式进军无人机领域。帝王品质给交易者们带来了什么指引?今天,我们来看看马可奥勒留罗马的最后一位好皇帝的生活心态,以及交易是如何为我们实现他的斯多葛主义提供了巨大的机会。这篇文章是斯多葛交易者系列文章的第二部分。在上一篇文章中,我们学习是雪中送炭还是锦上添花,聊聊智能家居那些事现在是智能时代,家居也不能免俗。好比如今的家电产品,不给自己贴上智能这两个字,都不好意思说自己是一台摆在卖场里的电器。当智能二字被如此广泛地滥用之际,我来聊一聊智能家居的那些事。在AI安防智能化发展至今还存在哪些问题?安防行业是AI人工智能落地比较成熟的应用领域,其先进性和未来的可发展性是毋庸置疑的。在人工智能技术落地安防领域之后,的确为安防行业带来了翻天覆地的变化,智能化数据化和便捷化的优势赋人工智能专业术语物体识别卷积神经网络YOLO分别都是什么?初学者区分不同的相关计算机视觉任务可能具有挑战性。例如,图像分类比较易于理解,但目标定位和目标检测之间的差异可能会令人困惑,尤其是当所有三个任务都可以等同地称为目标识别时。图像分类