没有看懂这些代码,能注释一下吗?
-
1 import sensor, image, time, os, tf
2
3 sensor.reset() # Reset and initialize the sensor.
4 sensor.set_pixformat(sensor.RGB565) # Set pixel format to RGB565 (or GRAYSCALE)
5 sensor.set_framesize(sensor.QVGA) # Set frame size to QVGA (320x240)
6 sensor.set_windowing((240, 240)) # Set 240x240 window.
7 sensor.skip_frames(time=2000) # Let the camera adjust.
8
9 net = "trained.tflite"
10 labels = [line.rstrip('\n') for line in open("labels.txt")]
11
12 clock = time.clock()
13 while(True):
14 clock.tick()
15
16 img = sensor.snapshot()
17
18 for obj in tf.classify(net, img, min_scale=1.0, scale_mul=0.8, x_overlap=0.5, y_overlap=0.5):
19 print("**********\nPredictions at [x=%d,y=%d,w=%d,h=%d]" % obj.rect())
20 img.draw_rectangle(obj.rect())
21 predictions_list = list(zip(labels, obj.output()))
22 for i in range(len(predictions_list)):
23 print("%s = %f" % (predictions_list[i][0], predictions_list[i][1]))
24 print(clock.fps(), "fps")有几行代码没有看懂,第14、18-24行的代码能注释一下吗?
-
https://singtown.com/learn/50872/
解释的很清楚了啊。