当前位置:首页>python>32岁零基础学Python量化 第8周 复现深层神经网络,成功识别了自己拍的猫图

32岁零基础学Python量化 第8周 复现深层神经网络,成功识别了自己拍的猫图

  • 2026-07-03 20:58:55
32岁零基础学Python量化 第8周 复现深层神经网络,成功识别了自己拍的猫图

构建深层神经网络模型(Deep Neural Network 简称DNN)

前言

上篇讲述了构建深层神经网络需要的函数模块,本篇重点讲述如何借助模块构建深层神经网络模型(DNN),用以对图片进行识别预测。训练过程就是教会电脑如何识别猫,给电脑209张包括但不仅限于猫咪的图片,每一张它读取后经过模型处理得到预测结果,将预测结果和实际结论进行比较并反向优化,将预测和实际间的差距逐渐缩小,最终经过反复迭代训练,给它一张之前没看过的图片,它能够判断该图片中是否含有猫咪。

类比到世界杯比赛结果预测,给模型输入历史上很多场比赛的赛前已知的相关信息,例如两支球队阵容,两队大名单球员历史数据,预选赛赛果,场馆位置,气候条件...等等,然后得到一个初步预测结果,将模型预测结果和实际结果进行比较,以缩小预测与实际结果为目标对模型进行优化,经过多轮迭代优化,最终得到一个优化好的模型,然后将需要预测的比赛的两队大名单球员历史数据,预选赛赛果,场馆位置,气候条件等等最新信息输入训练好的模型,最终得出比赛的预测结果。

我们下面就对之前有讲述过的两层的浅层神经网络和L层深层神经网络进行构建,两种模型相似度很高,因此放在一起讲。

模型构建前的准备

导入各种包:

import time                  # 导入 time 模块,通常用于计算代码运行耗时import numpy as np           # 导入 numpy 并简写为 np,用于高效的矩阵和数值计算import h5py                  # 导入 h5py 库,用于读取和写入 HDF5 格式的数据集文件import matplotlib.pyplot as plt  # 导入 matplotlib 的 pyplot 模块并简写为 plt,用于数据可视化绘图import scipy                 # 导入 scipy 科学计算库from PIL import Image        # 从 PIL (Pillow) 库导入 Image 模块,用于图像的读取和处理from scipy import ndimage    # 从 scipy 导入 ndimage 模块,常用于图像旋转、缩放等空间操作from dnn_app_utils_v2 import *   # 导入当前目录下的自定义工具脚本 dnn_app_utils_v2 中的所有函数(包含我们上一篇构建的那些基础函数)from matplotlib.pyplot import imread  # 从 matplotlib 导入 imread 函数,用于直接读取图片文件为数组(注:新版 matplotlib 已弃用此方法)%matplotlib inline           # Jupyter Notebook 魔法命令:让图表直接内嵌显示在代码单元格下方,无需单独弹窗plt.rcParams['figure.figsize'] = (5.0, 4.0)  # 设置 matplotlib 全局默认图表尺寸为宽 5.0、高 4.0 英寸plt.rcParams['image.interpolation'] = 'nearest'  # 设置图像插值方式为 'nearest'(最近邻),避免图像缩放时产生模糊plt.rcParams['image.cmap'] = 'gray'  # 设置图像默认颜色映射为灰度图(grayscale)%load_ext autoreload         # Jupyter 魔法命令:加载 autoreload 扩展,用于自动重载外部模块%autoreload 2                # 设置 autoreload 模式为 2:在运行代码前自动重载所有已导入的外部模块,修改外部 .py 文件后无需重启内核np.random.seed(1)            # 设置 numpy 随机数种子为 1,确保每次运行代码时生成的随机数序列相同,保证实验结果可复现

载入数据:

train_x_orig, train_y, test_x_orig, test_y, classes = load_data()#载入数据

显示数据集尺寸:

m_train = train_x_orig.shape[0]num_px = train_x_orig.shape[1]m_test = test_x_orig.shape[0]print ("Number of training examples: " + str(m_train))print ("Number of testing examples: " + str(m_test))print ("Each image is of size: (" + str(num_px) + ", " + str(num_px) + ", 3)")print ("train_x_orig shape: " + str(train_x_orig.shape))print ("train_y shape: " + str(train_y.shape))print ("test_x_orig shape: " + str(test_x_orig.shape))print ("test_y shape: " + str(test_y.shape))

数据集预处理:将64*64*3 RGB图像数据处理为扁平化(Flatten)的12288*1的数据,然后整体除以255(像素值范围是0~255),让数据的特征值限定在0和1之间,也就是之前讲的归一化处理

# 训练测试集数据预处理train_x_flatten = train_x_orig.reshape(train_x_orig.shape[0], -1).T   # 209行,列根据数组自行展开64*64*3=12288列 ,然后整体转置成12288行209列test_x_flatten = test_x_orig.reshape(test_x_orig.shape[0], -1).T# 数据标准化:让数据的特征值限定在0和1之间train_x = train_x_flatten/255.#将数组范围限定在0到1之间test_x = test_x_flatten/255.print ("train_x's shape: " + str(train_x.shape))print ("test_x's shape: " + str(test_x.shape))

两层神经网络的构建

  • • 输入 -> 线性变换 -> ReLU激活 -> 线性变换 -> Sigmoid激活 -> 输出
  • • 已准备好的模块(可以直接使用以下函数进行模型构建)
#1.参数初始化def initialize_parameters(n_x, n_h, n_y):    ...    return parameters#2.前向传播def linear_activation_forward(A_prev, W, b, activation):    ...    return A, cache# 3.计算成本函数costdef compute_cost(AL, Y):    ...    return cost#4.反向传播计算梯度def linear_activation_backward(dA, cache, activation):    ...    return dA_prev, dW, db#5.更新参数def update_parameters(parameters, grads, learning_rate):    ...    return parameters
  • • 代码逻辑模型输入:X,Y,layer_dims(各层节点数,由自己定义,输入输出层需根据实际数据确认),learning_rate(学习率,也就是步长),num_iterations(迭代次数,也就是循环迭代多少次)模型输出:parameters(训练好的模型参数)1.参数初始化for 循环num_iterations次(梯度下降法):2.前向传播(输入X -> 线性变换 -> ReLU激活 -> 线性变换 -> Sigmoid激活 -> 输出A2)3.计算成本函数cost4.反向传播计算梯度dW1,db1,dW2,db25.更新参数 W1,b1,W2,b26.用最后更新好的参数构建模型用于预测。
  • • 构建代码
#定义模型各层节点数n_x = 12288     # num_px * num_px * 3n_h = 7n_y = 1layers_dims = (n_x, n_h, n_y)#构建2层神经网络def two_layer_model(X, Y, layers_dims, learning_rate = 0.0075, num_iterations = 3000, print_cost=False):    """    实现一个两层神经网络,结构:线性层 -> ReLU激活 -> 线性层 -> Sigmoid激活。    形参:    X:输入数据,形状为 (n_x, 样本数量)    Y:真实的“标签”向量(0 代表猫,1 代表非猫),形状为 (1, 样本数量)    layers_dims:各层的维度,格式为 (n_x, n_h, n_y)    num_iterations:优化循环的迭代次数    learning_rate:梯度下降更新规则的学习率    print_cost:如果设为 True,则每迭代 100 次打印一次损失值(cost)     返回值:    parameters -- 一个包含 W1、W2、b1 和 b2 的字典    """    np.random.seed(1)    grads = {}                     #存储梯度的字典    costs = []                     # 存储cost的列表    m = X.shape[1]                 # 样本数量    (n_x, n_h, n_y) = layers_dims  #获取各层节点数    # 1.参数初始化    parameters = initialize_parameters(n_x, n_h, n_y)    # Get W1, b1, W2 and b2 from the dictionary parameters.    W1 = parameters["W1"]    b1 = parameters["b1"]    W2 = parameters["W2"]    b2 = parameters["b2"]    # 循环 (梯度下降法)    for i in range(0, num_iterations):        #2.前向传播(输入X -> 线性变换 -> ReLU激活 -> 线性变换 -> Sigmoid激活 -> 输出A2)        A1, cache1 = linear_activation_forward(X, W1, b1, activation = 'relu')        A2, cache2 = linear_activation_forward(A1, W2, b2, activation = 'sigmoid')        #3.计算成本函数cost        cost = compute_cost(A2, Y)        #  初始化反向传播        dA2 = - (np.divide(Y, A2) - np.divide(1 - Y, 1 - A2))        # 4.反向传播计算梯度dW1,db1,dW2,db2        dA1, dW2, db2 = linear_activation_backward(dA2, cache2, activation = 'sigmoid')        dA0, dW1, db1 = linear_activation_backward(dA1, cache1, activation = 'relu')        # 计算出的梯度更新进梯度字典        grads['dW1'] = dW1        grads['db1'] = db1        grads['dW2'] = dW2        grads['db2'] = db2        #5.更新参数 W1,b1,W2,b2        parameters = update_parameters(parameters, grads, learning_rate = 0.0075)        # 从 parameters 中提取 W1, b1, W2, b2        W1 = parameters["W1"]        b1 = parameters["b1"]        W2 = parameters["W2"]        b2 = parameters["b2"]        # 每训练 100 个样本,打印一次损失值(cost)        if print_cost and i % 100 == 0:            print("Cost after iteration {}: {}".format(i, np.squeeze(cost)))        if print_cost and i % 100 == 0:            costs.append(cost)    # 绘制损失值(cost)的变化曲线(画出代价函数图)    plt.plot(np.squeeze(costs))    plt.ylabel('cost')    plt.xlabel('iterations (per tens)')    plt.title("Learning rate =" + str(learning_rate))    plt.show()    return parameters
  • • 结果输出

parameters = two_layer_model(train_x, train_y, layers_dims = (n_x, n_h, n_y), num_iterations = 2500, print_cost=True)

predictions_test = predict(test_x, test_y, parameters)

输出:Accuracy: 0.72 (测试集预测准确率72%)

L层神经网络的构建

  • • 原理:[LINEAR -> RELU](L-1) -> LINEAR -> SIGMOID
  • • 准备好的模块
#1.参数初始化def initialize_parameters_deep(layer_dims):    ...    return parameters#2.前向传播def L_model_forward(X, parameters):    ...    return AL, caches#3.计算成本函数costdef compute_cost(AL, Y):    ...    return cost#4.反向传播计算梯度def L_model_backward(AL, Y, caches):    ...    return grads#5.更新参数 W1,b1,W2,b2def update_parameters(parameters, grads, learning_rate):    ...    return parameters
  • • 代码逻辑模型输入:X,Y,layer_dims(各层节点数,由自己定义,输入输出层需根据实际数据确认),learning_rate(学习率,也就是步长),num_iterations(迭代次数,也就是循环迭代多少次)模型输出:parameters(训练好的模型参数)1.参数初始化for 循环num_iterations次(梯度下降法):2.前向传播([LINEAR -> RELU](L-1) -> LINEAR -> SIGMOID)3.计算成本函数cost4.反向传播计算梯度grads5.使用计算好的梯度更新参数parameters6.用最后更新好的参数构建模型用于预测。
  • • 构建代码
#定义模型各层节点数layers_dims = [12288, 20, 7, 5, 1] #  定义5层神经网络各层节点数# 构建 L层神经网络模型def L_layer_model(X, Y, layers_dims, learning_rate = 0.0075, num_iterations = 3000, print_cost=False):#lr was 0.009    """    实现一个 L 层神经网络:[LINEAR->RELU]*(L-1)->LINEAR->SIGMOID。    形参:    X:输入数据,形状为 (样本数量, num_px * num_px * 3) 的 numpy 数组。    Y:真实的“标签”向量(0 代表猫,1 代表非猫),形状为 (1, 样本数量)。    layers_dims:一个列表,包含输入层大小以及每一层的大小,总长度为 (层数 + 1)。    learning_rate:梯度下降更新规则的学习率。    num_iterations:优化循环的迭代次数。    print_cost:如果设为 True,则每 100 步打印一次损失值(cost)。    返回值:    parameters:模型学习到的参数,后续可用于进行预测。    """    np.random.seed(1)    costs = []                         # keep track of cost    # 1.参数初始化    parameters = initialize_parameters_deep(layers_dims)    #for循环num_iterations次(梯度下降法)    for i in range(0, num_iterations):        #2.前向传播 输入:parameters,X  输出:caches,AL        AL, caches = L_model_forward(X, parameters)        #3.计算成本函数cost  输入:AL,Y  输出 cost        cost = compute_cost(AL, Y)        #4.反向传播计算梯度   输入:AL,Y,caches  输出:grads  错误写法:输入:dAL,caches  输出:grads        grads = L_model_backward(AL, Y, caches)        #5.使用计算好的梯度更新参数  输入:grads  parameters  输出:parameters        parameters = update_parameters(parameters, grads, learning_rate = 0.0075)        # 每一百次循环打印一次cost        if print_cost and i % 100 == 0:            print ("Cost after iteration %i: %f" %(i, cost))        if print_cost and i % 100 == 0:            costs.append(cost)    # 绘出成本函数图    plt.plot(np.squeeze(costs))    plt.ylabel('cost')    plt.xlabel('iterations (per tens)')    plt.title("Learning rate =" + str(learning_rate))    plt.show()    return parameters
  • • 结果输出
parameters = L_layer_model(train_x, train_y, layers_dims, num_iterations = 2500, print_cost = True)
pred_train = predict(train_x, train_y, parameters)

输出:Accuracy: 0.98 (测试集预测准确率98%)

实际预测能力

使用我自己的实拍图看下L层神经网络训练出来的模型真实预测效果:

my_image = "my_image.jpg"  # 修改为我的图片文件名my_label_y = [1]           # 图片的真实类别 (1 -> cat, 0 -> non-cat)import imageiofrom PIL import Imagefname = "images/" + my_image# 1. 使用 imageio 替代 ndimage.imreadimage = np.array(imageio.imread(fname))# 2. 使用 PIL 替代 scipy.misc.imresizemy_image_resized = np.array(Image.fromarray(image).resize((num_px, num_px)))my_image_processed = my_image_resized.reshape((num_px * num_px * 3, 1))my_image_processed = my_image_processed / 255.0# 3. 调用预测函数my_predicted_image = predict(my_image_processed, my_label_y, parameters)# 4. 显示图片plt.figure(figsize=(6, 4))plt.imshow(image)plt.show()# 5. 优化打印语句,避免 decode 报错predicted_class = int(np.squeeze(my_predicted_image))print("y = " + str(np.squeeze(my_predicted_image)) +      ", your L-layer model predicts a \"" +      classes[predicted_class].decode("utf-8") + "\" picture.")  # 加上 .decode("utf-8")

最终预测结果正确:

阶段性完结,撒花~~~

最新文章

随机文章

基本 文件 流程 错误 SQL 调试
  1. 请求信息 : 2026-07-03 23:42:57 HTTP/2.0 GET : https://f.mffb.com.cn/a/503318.html
  2. 运行时间 : 0.403187s [ 吞吐率:2.48req/s ] 内存消耗:4,288.41kb 文件加载:140
  3. 缓存信息 : 0 reads,0 writes
  4. 会话信息 : SESSION_ID=643f9f38d33b1513cea9396357496dd8
  1. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/public/index.php ( 0.79 KB )
  2. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/autoload.php ( 0.17 KB )
  3. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/composer/autoload_real.php ( 2.49 KB )
  4. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/composer/platform_check.php ( 0.90 KB )
  5. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/composer/ClassLoader.php ( 14.03 KB )
  6. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/composer/autoload_static.php ( 4.90 KB )
  7. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-helper/src/helper.php ( 8.34 KB )
  8. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-validate/src/helper.php ( 2.19 KB )
  9. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/helper.php ( 1.47 KB )
  10. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/stubs/load_stubs.php ( 0.16 KB )
  11. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Exception.php ( 1.69 KB )
  12. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-container/src/Facade.php ( 2.71 KB )
  13. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/symfony/deprecation-contracts/function.php ( 0.99 KB )
  14. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/symfony/polyfill-mbstring/bootstrap.php ( 8.26 KB )
  15. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/symfony/polyfill-mbstring/bootstrap80.php ( 9.78 KB )
  16. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/symfony/var-dumper/Resources/functions/dump.php ( 1.49 KB )
  17. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-dumper/src/helper.php ( 0.18 KB )
  18. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/symfony/var-dumper/VarDumper.php ( 4.30 KB )
  19. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/App.php ( 15.30 KB )
  20. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-container/src/Container.php ( 15.76 KB )
  21. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/psr/container/src/ContainerInterface.php ( 1.02 KB )
  22. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/app/provider.php ( 0.19 KB )
  23. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Http.php ( 6.04 KB )
  24. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-helper/src/helper/Str.php ( 7.29 KB )
  25. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Env.php ( 4.68 KB )
  26. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/app/common.php ( 0.03 KB )
  27. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/helper.php ( 18.78 KB )
  28. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Config.php ( 5.54 KB )
  29. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/app.php ( 0.95 KB )
  30. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/cache.php ( 0.78 KB )
  31. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/console.php ( 0.23 KB )
  32. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/cookie.php ( 0.56 KB )
  33. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/database.php ( 2.48 KB )
  34. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/facade/Env.php ( 1.67 KB )
  35. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/filesystem.php ( 0.61 KB )
  36. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/lang.php ( 0.91 KB )
  37. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/log.php ( 1.35 KB )
  38. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/middleware.php ( 0.19 KB )
  39. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/route.php ( 1.89 KB )
  40. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/session.php ( 0.57 KB )
  41. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/trace.php ( 0.34 KB )
  42. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/view.php ( 0.82 KB )
  43. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/app/event.php ( 0.25 KB )
  44. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Event.php ( 7.67 KB )
  45. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/app/service.php ( 0.13 KB )
  46. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/app/AppService.php ( 0.26 KB )
  47. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Service.php ( 1.64 KB )
  48. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Lang.php ( 7.35 KB )
  49. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/lang/zh-cn.php ( 13.70 KB )
  50. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/initializer/Error.php ( 3.31 KB )
  51. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/initializer/RegisterService.php ( 1.33 KB )
  52. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/services.php ( 0.14 KB )
  53. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/service/PaginatorService.php ( 1.52 KB )
  54. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/service/ValidateService.php ( 0.99 KB )
  55. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/service/ModelService.php ( 2.04 KB )
  56. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-trace/src/Service.php ( 0.77 KB )
  57. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Middleware.php ( 6.72 KB )
  58. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/initializer/BootService.php ( 0.77 KB )
  59. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/Paginator.php ( 11.86 KB )
  60. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-validate/src/Validate.php ( 63.20 KB )
  61. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/Model.php ( 23.55 KB )
  62. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/model/concern/Attribute.php ( 21.05 KB )
  63. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/model/concern/AutoWriteData.php ( 4.21 KB )
  64. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/model/concern/Conversion.php ( 6.44 KB )
  65. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/model/concern/DbConnect.php ( 5.16 KB )
  66. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/model/concern/ModelEvent.php ( 2.33 KB )
  67. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/model/concern/RelationShip.php ( 28.29 KB )
  68. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-helper/src/contract/Arrayable.php ( 0.09 KB )
  69. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-helper/src/contract/Jsonable.php ( 0.13 KB )
  70. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/model/contract/Modelable.php ( 0.09 KB )
  71. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Db.php ( 2.88 KB )
  72. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/DbManager.php ( 8.52 KB )
  73. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Log.php ( 6.28 KB )
  74. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Manager.php ( 3.92 KB )
  75. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/psr/log/src/LoggerTrait.php ( 2.69 KB )
  76. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/psr/log/src/LoggerInterface.php ( 2.71 KB )
  77. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Cache.php ( 4.92 KB )
  78. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/psr/simple-cache/src/CacheInterface.php ( 4.71 KB )
  79. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-helper/src/helper/Arr.php ( 16.63 KB )
  80. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/cache/driver/File.php ( 7.84 KB )
  81. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/cache/Driver.php ( 9.03 KB )
  82. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/contract/CacheHandlerInterface.php ( 1.99 KB )
  83. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/app/Request.php ( 0.09 KB )
  84. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Request.php ( 55.78 KB )
  85. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/app/middleware.php ( 0.25 KB )
  86. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Pipeline.php ( 2.61 KB )
  87. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-trace/src/TraceDebug.php ( 3.40 KB )
  88. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/middleware/SessionInit.php ( 1.94 KB )
  89. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Session.php ( 1.80 KB )
  90. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/session/driver/File.php ( 6.27 KB )
  91. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/contract/SessionHandlerInterface.php ( 0.87 KB )
  92. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/session/Store.php ( 7.12 KB )
  93. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Route.php ( 23.73 KB )
  94. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/route/RuleName.php ( 5.75 KB )
  95. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/route/Domain.php ( 2.53 KB )
  96. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/route/RuleGroup.php ( 22.43 KB )
  97. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/route/Rule.php ( 26.95 KB )
  98. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/route/RuleItem.php ( 9.78 KB )
  99. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/route/app.php ( 1.72 KB )
  100. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/facade/Route.php ( 4.70 KB )
  101. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/route/dispatch/Controller.php ( 4.74 KB )
  102. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/route/Dispatch.php ( 10.44 KB )
  103. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/app/controller/Index.php ( 4.81 KB )
  104. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/app/BaseController.php ( 2.05 KB )
  105. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/facade/Db.php ( 0.93 KB )
  106. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/connector/Mysql.php ( 5.44 KB )
  107. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/PDOConnection.php ( 52.47 KB )
  108. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/Connection.php ( 8.39 KB )
  109. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/ConnectionInterface.php ( 4.57 KB )
  110. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/builder/Mysql.php ( 16.58 KB )
  111. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/Builder.php ( 24.06 KB )
  112. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/BaseBuilder.php ( 27.50 KB )
  113. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/Query.php ( 15.71 KB )
  114. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/BaseQuery.php ( 45.13 KB )
  115. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/concern/TimeFieldQuery.php ( 7.43 KB )
  116. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/concern/AggregateQuery.php ( 3.26 KB )
  117. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/concern/ModelRelationQuery.php ( 20.07 KB )
  118. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/concern/ParamsBind.php ( 3.66 KB )
  119. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/concern/ResultOperation.php ( 7.01 KB )
  120. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/concern/WhereQuery.php ( 19.37 KB )
  121. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/concern/JoinAndViewQuery.php ( 7.11 KB )
  122. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/concern/TableFieldInfo.php ( 2.63 KB )
  123. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/concern/Transaction.php ( 2.77 KB )
  124. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/log/driver/File.php ( 5.96 KB )
  125. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/contract/LogHandlerInterface.php ( 0.86 KB )
  126. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/log/Channel.php ( 3.89 KB )
  127. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/event/LogRecord.php ( 1.02 KB )
  128. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-helper/src/Collection.php ( 16.47 KB )
  129. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/facade/View.php ( 1.70 KB )
  130. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/View.php ( 4.39 KB )
  131. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Response.php ( 8.81 KB )
  132. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/response/View.php ( 3.29 KB )
  133. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Cookie.php ( 6.06 KB )
  134. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-view/src/Think.php ( 8.38 KB )
  135. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/contract/TemplateHandlerInterface.php ( 1.60 KB )
  136. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-template/src/Template.php ( 46.61 KB )
  137. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-template/src/template/driver/File.php ( 2.41 KB )
  138. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-template/src/template/contract/DriverInterface.php ( 0.86 KB )
  139. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/runtime/temp/067d451b9a0c665040f3f1bdd3293d68.php ( 11.98 KB )
  140. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-trace/src/Html.php ( 4.42 KB )
  1. CONNECT:[ UseTime:0.000745s ] mysql:host=127.0.0.1;port=3306;dbname=f_mffb;charset=utf8mb4
  2. SHOW FULL COLUMNS FROM `fenlei` [ RunTime:0.000536s ]
  3. SELECT * FROM `fenlei` WHERE `fid` = 0 [ RunTime:0.005053s ]
  4. SELECT * FROM `fenlei` WHERE `fid` = 63 [ RunTime:0.016392s ]
  5. SHOW FULL COLUMNS FROM `set` [ RunTime:0.000666s ]
  6. SELECT * FROM `set` [ RunTime:0.003262s ]
  7. SHOW FULL COLUMNS FROM `article` [ RunTime:0.000629s ]
  8. SELECT * FROM `article` WHERE `id` = 503318 LIMIT 1 [ RunTime:0.059789s ]
  9. UPDATE `article` SET `lasttime` = 1783093377 WHERE `id` = 503318 [ RunTime:0.021649s ]
  10. SELECT * FROM `fenlei` WHERE `id` = 66 LIMIT 1 [ RunTime:0.000316s ]
  11. SELECT * FROM `article` WHERE `id` < 503318 ORDER BY `id` DESC LIMIT 1 [ RunTime:0.055625s ]
  12. SELECT * FROM `article` WHERE `id` > 503318 ORDER BY `id` ASC LIMIT 1 [ RunTime:0.019057s ]
  13. SELECT * FROM `article` WHERE `id` < 503318 ORDER BY `id` DESC LIMIT 10 [ RunTime:0.046341s ]
  14. SELECT * FROM `article` WHERE `id` < 503318 ORDER BY `id` DESC LIMIT 10,10 [ RunTime:0.044666s ]
  15. SELECT * FROM `article` WHERE `id` < 503318 ORDER BY `id` DESC LIMIT 20,10 [ RunTime:0.026745s ]
0.404798s