parameters: (images, splits=10)
return_statement: return np.mean(scores), np.std(scores)
docstring: Inception_score function.
          The images will be divided into 'splits' parts, and calculate each inception_score separately,
          then return the mean and std of inception_scores of these parts.
      :param images: Images(num x c x w x h) that needs to calculate inception_score.
      :param splits:
      :return: mean and std of inception_score
docstring_summary: Inception_score function.
          The images will be divided into 'splits' parts, and calculate each inception_score separately,
          then return the mean and std of inception_scores of these parts.
      :param images: Images(num x c x w x h) that needs to calculate inception_score.
      :param splits:
      :return: mean and std of inception_score
docstring_tokens: Inception_score function . The images will be divided into splits parts and calculate each inception_score separately then return the mean and std of inception_scores of these parts . : param images : Images ( num x c x w x h ) that needs to calculate inception_score . : param splits : : return : mean and std of inception_score
function: def get_inception_score(images, splits=10):
      """
      Inception_score function.
          The images will be divided into 'splits' parts, and calculate each inception_score separately,
          then return the mean and std of inception_scores of these parts.
      :param images: Images(num x c x w x h) that needs to calculate inception_score.
      :param splits:
      :return: mean and std of inception_score
      """
      assert (images.shape[1] == 3)
  
      # load inception model
      if inception_model is None:
          _init_inception()
  
      # resize images to adapt inception model(inceptionV3)
      if images.shape[2] != 299:
          images = resize(images, 299, 299)
  
      preds = []
      bs = 4
      n_batches = int(math.ceil(float(images.shape[0])/float(bs)))
  
      # to get the predictions/picture of inception model
      for i in range(n_batches):
          sys.stdout.write(".")
          sys.stdout.flush()
          inps = images[(i * bs):min((i + 1) * bs, len(images))]
          # inps size. bs x 3 x 299 x 299
          pred = nd.softmax(inception_model(inps))
          # pred size. bs x 1000
          preds.append(pred.asnumpy())
  
      # list to array
      preds = np.concatenate(preds, 0)
      scores = []
  
      # to calculate the inception_score each split.
      for i in range(splits):
          # extract per split image pred
          part = preds[(i * preds.shape[0] // splits):((i + 1) * preds.shape[0] // splits), :]
          kl = part * (np.log(part) - np.log(np.expand_dims(np.mean(part, 0), 0)))
          kl = np.mean(np.sum(kl, 1))
          scores.append(np.exp(kl))
  
      return np.mean(scores), np.std(scores)
function_tokens: def get_inception_score ( images , splits = 10 ) : assert ( images . shape [ 1 ] == 3 ) # load inception model if inception_model is None : _init_inception ( ) # resize images to adapt inception model(inceptionV3) if images . shape [ 2 ] != 299 : images = resize ( images , 299 , 299 ) preds = [ ] bs = 4 n_batches = int ( math . ceil ( float ( images . shape [ 0 ] ) / float ( bs ) ) ) # to get the predictions/picture of inception model for i in range ( n_batches ) : sys . stdout . write ( "." ) sys . stdout . flush ( ) inps = images [ ( i * bs ) : min ( ( i + 1 ) * bs , len ( images ) ) ] # inps size. bs x 3 x 299 x 299 pred = nd . softmax ( inception_model ( inps ) ) # pred size. bs x 1000 preds . append ( pred . asnumpy ( ) ) # list to array preds = np . concatenate ( preds , 0 ) scores = [ ] # to calculate the inception_score each split. for i in range ( splits ) : # extract per split image pred part = preds [ ( i * preds . shape [ 0 ] // splits ) : ( ( i + 1 ) * preds . shape [ 0 ] // splits ) , : ] kl = part * ( np . log ( part ) - np . log ( np . expand_dims ( np . mean ( part , 0 ) , 0 ) ) ) kl = np . mean ( np . sum ( kl , 1 ) ) scores . append ( np . exp ( kl ) ) return np . mean ( scores ) , np . std ( scores )