<label id="jgr5k"></label>
    <legend id="jgr5k"><track id="jgr5k"></track></legend>

    <sub id="jgr5k"></sub>
  1. <u id="jgr5k"></u>
      久草国产视频,91资源总站,在线免费看AV,丁香婷婷社区,久久精品99久久久久久久久,色天使av,无码探花,香蕉av在线
      您正在使用IE低版瀏覽器,為了您的雷峰網賬號安全和更好的產品體驗,強烈建議使用更快更安全的瀏覽器
      此為臨時鏈接,僅用于文章預覽,將在時失效
      人工智能開發者 正文
      發私信給AI研習社-譯站
      發送

      0

      機器學習開發者應該收藏的 DIY 計算機視覺和深度學習項目

      本文作者: AI研習社-譯站 2018-06-13 15:10
      導語:在這篇文章中你將看到一些應用計算機視覺和深度學習的項目,包括具體實現和細節,你可以在自己的電腦上復現這些項目。

      本文為雷鋒網字幕組編譯的技術博客,原標題 DIY Deep Learning Projects,作者為 Favio Vázquez。

      翻譯 | 趙朋飛、林驍    整理 |  孔令雙

      雷鋒網按,在這篇文章中雷鋒網將推薦一些應用計算機視覺和深度學習的項目,包括具體實現和細節,你可以在自己的電腦上復現這些項目。

      LinkedIn 數據科學社區

      Akshay Bahadur 是 LinkedIn 數據科學社區給出的最好的榜樣。在其他諸如 Quora、StackOverflow、Youtube 等平臺,有很多優秀的人,以及很多論壇和平臺在科學、哲學、數學、語言學,以及數據科學等領域互相幫助。

      機器學習開發者應該收藏的 DIY 計算機視覺和深度學習項目

      Akshay Bahadur

      但我認為在過去的 ~3 年間,LinkedIn 社區在共享數據科學內容方面做的非常優秀,從分享經驗,到關于如何在現實世界進行機器學習的文章。我經常建議想從事這一領域的人加入這個社區,而且 LinkedIn 是最好的,你可以在那里隨時找到我 :)。

      從深度學習和計算機視覺開始  

      機器學習開發者應該收藏的 DIY 計算機視覺和深度學習項目

      https://github.com/facebookresearch/Detectron

      在這十年里,在深度學習領域中對圖像進行分類、檢測和執行相應動作的研究是非常重要的,其結果令人驚訝,有些問題的解決在性能已經超越了人類水平。

      在這篇文章中,我將展示 Akshay Bahadur在計算機視覺和深度學習領域所做的工作。如果你對這些概念還不熟悉,可以通過閱讀下面這些內容學到更多:

      • 對深度學習的「怪異」介紹  

        這里有關于深度學習的精彩介紹、課程以及博客文章。但這是一種很獨特的介紹。

        https://towardsdatascience.com/a-weird-introduction-to-deep-learning-7828803693b0

      • 兩個月探索深度學習和計算機視覺

        我決定深入了解計算機視覺和機器學習。作為一個網頁開發者,我發現了這個。

        https://towardsdatascience.com/two-months-exploring-deep-learning-and-computer-vision-3dcc84b2457f

      • 從神經科學到計算機視覺  

        人類和計算機視覺的50年。

        https://towardsdatascience.com/from-neuroscience-to-computer-vision-e86a4dea3574

      • 吳恩達計算機視覺 —— 11 個經驗教訓

        我最近剛完成吳恩達在 Coursera 上的計算機視覺課程。吳恩達在解釋這些問題方面做了杰出的工作。

        https://towardsdatascience.com/computer-vision-by-andrew-ng-11-lessons-learned-7d05c18a6999

      1. 使用 OpenCV 手動執行

      akshaybahadur21/HandMovementTracking

      https://github.com/akshaybahadur21/HandMovementTracking

      機器學習開發者應該收藏的 DIY 計算機視覺和深度學習項目


       Akshay:

      為了執行視頻追蹤,算法需要分析視頻幀序列并輸出每幀之間的目標位移。有很多種算法,每種各有強項和弱點。選擇使用哪種算法,重要的是要考慮應用目的。視頻追蹤系統有兩個主要的組成部分:目標表示和定位,以及濾波和數據關聯。

      視頻追蹤是通過攝像頭定位一個(或多個)移動目標的過程。擁有多種用途,比如,人機交互、安全監視、視頻通訊與壓縮、增強現實、交通控制、醫學影像,以及視頻編輯等。

      下面是你在復現它時需要用到的代碼:

      import numpy as np
      import cv2
      import argparse
      from collections import deque


      cap=cv2.VideoCapture(0)

      pts = deque(maxlen=64)

      Lower_green = np.array([110,50,50])
      Upper_green = np.array([130,255,255])
      while True:
      ret, img=cap.read()
      hsv=cv2.cvtColor(img,cv2.COLOR_BGR2HSV)
      kernel=np.ones((5,5),np.uint8)
      mask=cv2.inRange(hsv,Lower_green,Upper_green)
      mask = cv2.erode(mask, kernel, iterations=2)
      mask=cv2.morphologyEx(mask,cv2.MORPH_OPEN,kernel)
      #mask=cv2.morphologyEx(mask,cv2.MORPH_CLOSE,kernel)
      mask = cv2.dilate(mask, kernel, iterations=1)
      res=cv2.bitwise_and(img,img,mask=mask)
      cnts,heir=cv2.findContours(mask.copy(),cv2.RETR_EXTERNAL,cv2.CHAIN_APPROX_SIMPLE)[-2:]
      center = None

      if len(cnts) > 0:
        c = max(cnts, key=cv2.contourArea)
        ((x, y), radius) = cv2.minEnclosingCircle(c)
        M = cv2.moments(c)
        center = (int(M["m10"] / M["m00"]), int(M["m01"] / M["m00"]))

        if radius > 5:
          cv2.circle(img, (int(x), int(y)), int(radius),(0, 255, 255), 2)
          cv2.circle(img, center, 5, (0, 0, 255), -1)
        
      pts.appendleft(center)
      for i in xrange (1,len(pts)):
        if pts[i-1]is None or pts[i] is None:
          continue
        thick = int(np.sqrt(len(pts) / float(i + 1)) * 2.5)
        cv2.line(img, pts[i-1],pts[i],(0,0,225),thick)
        

      cv2.imshow("Frame", img)
      cv2.imshow("mask",mask)
      cv2.imshow("res",res)


      k=cv2.waitKey(30) & 0xFF
      if k==32:
        break
      # cleanup the camera and close any open windows
      cap.release()
      cv2.destroyAllWindows()

      是的,54 行代碼,相當簡單?如果你的電腦檢查結果如下面所示的話,你需要先安裝 OpenCV:

      在 MacOS 上安裝 OpenCV

      這篇文章中,我么將逐步介紹在 MacOS 和 OSX 上安裝 OpenCV 3.3.0 (C++ and Python)。

      https://www.learnopencv.com/install-opencv3-on-macos/

      如果你使用 Ubuntu:

      OpenCV:在 Ubuntu 上安裝 OpenCV-Python  

      有了所有必須的依賴項,讓我們安裝 OpenCV。需要使用 CMake 配置安裝選項項

      https://docs.opencv.org/3.4.1/d2/de6/tutorial_py_setup_in_ubuntu.html

      如果使用 Windows:

      Windows 安裝 OpenCV-Python- OpenCV 3.0.0-dev documentation

      在這篇教程中我們將學習在 Windows 系統中如何設置O penCV-Python。下面的步驟在 Windows 7-64 中測試通過

      https://docs.opencv.org/3.0-beta/doc/py_tutorials/py_setup/py_setup_in_windows/py_setup_in_windows.html


      2.基于 OpenCV 的疲勞檢測

      akshaybahadur21/Drowsiness_Detection

      在 GitHub.github.com 創建賬號有助于疲勞檢測項目開發

      https://github.com/akshaybahadur21/Drowsiness_Detection

      駕駛員長時間駕駛有可能會導致事故發生。這段代碼檢測你的眼睛,瞌睡時會發出告警。

      依賴項:

      • cv2

      • immutils

      • dlib

      • scipy

      算法

      每個眼睛使用 6個 (x, y)坐標表示,從眼睛的左角開始(正如你看見人時一樣), 然后沿著眼睛周圍順時針計算。

      機器學習開發者應該收藏的 DIY 計算機視覺和深度學習項目


      條件

      檢查連續 20 幀圖像,如果眼睛長寬比小于 0.25,就發出告警。

      機器學習開發者應該收藏的 DIY 計算機視覺和深度學習項目


      關系

      機器學習開發者應該收藏的 DIY 計算機視覺和深度學習項目


      3. 使用 SoftMax 回歸進行數字識別

      akshaybahadur21/Digit-Recognizer

      在 Github.com 上的機器學習分類器-數字識別

      https://github.com/akshaybahadur21/Digit-Recognizer

      在程序中利用 SoftMax 回歸代碼能夠幫助你區分不同的數字。你可以為 Python 安裝 Conda,它可以為你提供所有與 Python 有關相關庫的編譯環境。

      描述

      Softmax 回歸是邏輯回歸的推廣,我們可以用它來解決多分類問題,假設這些分類是互斥的(同義詞:多項邏輯推理,最大熵分類器,或多類邏輯回歸)。相反,我們在二分類問題中通常使用邏輯回歸模型。

      機器學習開發者應該收藏的 DIY 計算機視覺和深度學習項目


      Python 實現

      數據集使用 MNIST 數據集,同時圖像大小為 28*28,利用邏輯回歸、淺層神經網絡和深層神經網絡的方法將 0—9 進行分類。 

      三個模型當中最好的部分之一是使用 Numpy 函數庫,包括優化,前向傳播和后向傳播。

      邏輯回歸:

      import numpy as np
      import matplotlib.pyplot as plt

      def softmax(z):
        z -= np.max(z)
        sm = (np.exp(z).T / np.sum(np.exp(z), axis=1))
        return sm


      def initialize(dim1, dim2):
        """
        :param dim: size of vector w initilazied with zeros
        :return:
        """
        w = np.zeros(shape=(dim1, dim2))
        b = np.zeros(shape=(10, 1))
        return w, b


      def propagate(w, b, X, Y):
        """
        :param w: weights for w
        :param b: bias
        :param X: size of data(no of features, no of examples)
        :param Y: true label
        :return:
        """
        m = X.shape[1]  # getting no of rows

        # Forward Prop
        A = softmax((np.dot(w.T, X) + b).T)
        cost = (-1 / m) * np.sum(Y * np.log(A))

        # backwar prop
        dw = (1 / m) * np.dot(X, (A - Y).T)
        db = (1 / m) * np.sum(A - Y)

        cost = np.squeeze(cost)
        grads = {"dw": dw,
                 "db": db}
        return grads, cost


      def optimize(w, b, X, Y, num_iters, alpha, print_cost=False):
        """
        :param w: weights for w
        :param b: bias
        :param X: size of data(no of features, no of examples)
        :param Y: true label
        :param num_iters: number of iterations for gradient
        :param alpha:
        :return:
        """

        costs = []
        for i in range(num_iters):
            grads, cost = propagate(w, b, X, Y)
            dw = grads["dw"]
            db = grads["db"]
            w = w - alpha * dw
            b = b - alpha * db

            # Record the costs
            if i % 50 == 0:
                costs.append(cost)

            # Print the cost every 100 training examples
            if print_cost and i % 50 == 0:
                print("Cost after iteration %i: %f" % (i, cost))

        params = {"w": w,
                  "b": b}

        grads = {"dw": dw,
                 "db": db}

        return params, grads, costs


      def predict(w, b, X):
        """
        :param w:
        :param b:
        :param X:
        :return:
        """
        # m = X.shape[1]
        # y_pred = np.zeros(shape=(1, m))
        # w = w.reshape(X.shape[0], 1)

        y_pred = np.argmax(softmax((np.dot(w.T, X) + b).T), axis=0)
        return y_pred


      def model(X_train, Y_train, Y,X_test,Y_test, num_iters, alpha, print_cost):
        """
        :param X_train:
        :param Y_train:
        :param X_test:
        :param Y_test:
        :param num_iterations:
        :param learning_rate:
        :param print_cost:
        :return:
        """

        w, b = initialize(X_train.shape[0], Y_train.shape[0])
        parameters, grads, costs = optimize(w, b, X_train, Y_train, num_iters, alpha, print_cost)

        w = parameters["w"]
        b = parameters["b"]


        y_prediction_train = predict(w, b, X_train)
        y_prediction_test = predict(w, b, X_test)
        print("Train accuracy: {} %", sum(y_prediction_train == Y) / (float(len(Y))) * 100)
        print("Test accuracy: {} %", sum(y_prediction_test == Y_test) / (float(len(Y_test))) * 100)

        d = {"costs": costs,
             "Y_prediction_test": y_prediction_test,
             "Y_prediction_train": y_prediction_train,
             "w": w,
             "b": b,
             "learning_rate": alpha,
             "num_iterations": num_iters}

        # Plot learning curve (with costs)
        #costs = np.squeeze(d['costs'])
        #plt.plot(costs)
        #plt.ylabel('cost')
        #plt.xlabel('iterations (per hundreds)')
        #plt.title("Learning rate =" + str(d["learning_rate"]))
        #plt.plot()
        #plt.show()
        #plt.close()

        #pri(X_test.T, y_prediction_test)
        return d


      def pri(X_test, y_prediction_test):
        example = X_test[2, :]
        print("Prediction for the example is ", y_prediction_test[2])
        plt.imshow(np.reshape(example, [28, 28]))
        plt.plot()
        plt.show()

      淺層神經網絡

      import numpy as np
      import matplotlib.pyplot as plt

      def softmax(z):
        z -= np.max(z)
        sm = (np.exp(z).T / np.sum(np.exp(z),axis=1))
        return sm


      def layers(X, Y):
        """
        :param X:
        :param Y:
        :return:
        """
        n_x = X.shape[0]
        n_y = Y.shape[0]
        return n_x, n_y


      def initialize_nn(n_x, n_h, n_y):
        """
        :param n_x:
        :param n_h:
        :param n_y:
        :return:
        """
        np.random.seed(2)
        W1 = np.random.randn(n_h, n_x) * 0.01
        b1 = np.random.rand(n_h, 1)
        W2 = np.random.rand(n_y, n_h)
        b2 = np.random.rand(n_y, 1)
        parameters = {"W1": W1,
                      "b1": b1,
                      "W2": W2,
                      "b2": b2}

        return parameters


      def forward_prop(X, parameters):
        W1 = parameters['W1']
        b1 = parameters['b1']
        W2 = parameters['W2']
        b2 = parameters['b2']

        Z1 = np.dot(W1, X) + b1
        A1 = np.tanh(Z1)
        Z2 = np.dot(W2, A1) + b2
        A2 = softmax(Z2.T)

        cache = {"Z1": Z1,
                 "A1": A1,
                 "Z2": Z2,
                 "A2": A2}

        return A2, cache


      def compute_cost(A2, Y, parameters):
        m = Y.shape[1]
        W1 = parameters['W1']
        W2 = parameters['W2']
        logprobs = np.multiply(np.log(A2), Y)
        cost = - np.sum(logprobs) / m
        cost = np.squeeze(cost)

        return cost


      def back_prop(parameters, cache, X, Y):
        m = Y.shape[1]
        W1 = parameters['W1']
        W2 = parameters['W2']
        A1 = cache['A1']
        A2 = cache['A2']


        dZ2 = A2 - Y
        dW2 = (1 / m) * np.dot(dZ2, A1.T)
        db2 = (1 / m) * np.sum(dZ2, axis=1, keepdims=True)

        dZ1 = np.multiply(np.dot(W2.T, dZ2), 1 - np.square(A1))
        dW1 = (1 / m) * np.dot(dZ1, X.T)
        db1 = (1 / m) * np.sum(dZ1, axis=1, keepdims=True)

        grads = {"dW1": dW1,
                 "db1": db1,
                 "dW2": dW2,
                 "db2": db2}

        return grads


      def update_params(parameters, grads, alpha):
        W1 = parameters['W1']
        b1 = parameters['b1']
        W2 = parameters['W2']
        b2 = parameters['b2']

        dW1 = grads['dW1']
        db1 = grads['db1']
        dW2 = grads['dW2']
        db2 = grads['db2']

        W1 = W1 - alpha * dW1
        b1 = b1 - alpha * db1
        W2 = W2 - alpha * dW2
        b2 = b2 - alpha * db2

        parameters = {"W1": W1,
                      "b1": b1,
                      "W2": W2,
                      "b2": b2}
        return parameters


      def model_nn(X, Y,Y_real,test_x,test_y, n_h, num_iters, alpha, print_cost):
        np.random.seed(3)
        n_x,n_y = layers(X, Y)
        parameters = initialize_nn(n_x, n_h, n_y)
        W1 = parameters['W1']
        b1 = parameters['b1']
        W2 = parameters['W2']
        b2 = parameters['b2']

        costs = []
        for i in range(0, num_iters):

            A2, cache = forward_prop(X, parameters)

            cost = compute_cost(A2, Y, parameters)
            grads = back_prop(parameters, cache, X, Y)
            if (i > 1500):
                alpha1 = 0.95*alpha
                parameters = update_params(parameters, grads, alpha1)
            else:
                parameters = update_params(parameters, grads, alpha)

            if i % 100 == 0:
                costs.append(cost)
            if print_cost and i % 100 == 0:
                print("Cost after iteration for %i: %f" % (i, cost))



        predictions = predict_nn(parameters, X)
        print("Train accuracy: {} %", sum(predictions == Y_real) / (float(len(Y_real))) * 100)
        predictions=predict_nn(parameters,test_x)
        print("Train accuracy: {} %", sum(predictions == test_y) / (float(len(test_y))) * 100)



        #plt.plot(costs)
        #plt.ylabel('cost')
        #plt.xlabel('iterations (per hundreds)')
        #plt.title("Learning rate =" + str(alpha))
        #plt.show()

        return parameters


      def predict_nn(parameters, X):
        A2, cache = forward_prop(X, parameters)
        predictions = np.argmax(A2, axis=0)
        return predictions

      以及最后的深層神經網絡:

      import numpy as np
      import matplotlib.pyplot as plt


      def softmax(z):
        cache = z
        z -= np.max(z)
        sm = (np.exp(z).T / np.sum(np.exp(z), axis=1))
        return sm, cache


      def relu(z):
        """
        :param z:
        :return:
        """
        s = np.maximum(0, z)
        cache = z
        return s, cache


      def softmax_backward(dA, cache):
        """
        :param dA:
        :param activation_cache:
        :return:
        """
        z = cache
        z -= np.max(z)
        s = (np.exp(z).T / np.sum(np.exp(z), axis=1))
        dZ = dA * s * (1 - s)
        return dZ


      def relu_backward(dA, cache):
        """
        :param dA:
        :param activation_cache:
        :return:
        """
        Z = cache
        dZ = np.array(dA, copy=True)  # just converting dz to a correct object.
        dZ[Z <= 0] = 0
        return dZ


      def initialize_parameters_deep(dims):
        """
        :param dims:
        :return:
        """

        np.random.seed(3)
        params = {}
        L = len(dims)

        for l in range(1, L):
            params['W' + str(l)] = np.random.randn(dims[l], dims[l - 1]) * 0.01
            params['b' + str(l)] = np.zeros((dims[l], 1))
        return params


      def linear_forward(A, W, b):
        """
        :param A:
        :param W:
        :param b:
        :return:
        """

        Z = np.dot(W, A) + b
        cache = (A, W, b)

        return Z, cache


      def linear_activation_forward(A_prev, W, b, activation):
        """
        :param A_prev:
        :param W:
        :param b:
        :param activation:
        :return:
        """
        if activation == "softmax":
            Z, linear_cache = linear_forward(A_prev, W, b)
            A, activation_cache = softmax(Z.T)

        elif activation == "relu":
            Z, linear_cache = linear_forward(A_prev, W, b)
            A, activation_cache = relu(Z)

        cache = (linear_cache, activation_cache)

        return A, cache


      def L_model_forward(X, params):
        """
        :param X:
        :param params:
        :return:
        """

        caches = []
        A = X
        L = len(params) // 2  # number of layers in the neural network

        # Implement [LINEAR -> RELU]*(L-1). Add "cache" to the "caches" list.
        for l in range(1, L):
            A_prev = A
            A, cache = linear_activation_forward(A_prev,
                                                 params["W" + str(l)],
                                                 params["b" + str(l)],
                                                 activation='relu')
            caches.append(cache)

        A_last, cache = linear_activation_forward(A,
                                                  params["W" + str(L)],
                                                  params["b" + str(L)],
                                                  activation='softmax')
        caches.append(cache)
        return A_last, caches


      def compute_cost(A_last, Y):
        """
        :param A_last:
        :param Y:
        :return:
        """

        m = Y.shape[1]
        cost = (-1 / m) * np.sum(Y * np.log(A_last))
        cost = np.squeeze(cost)  # To make sure your cost's shape is what we expect (e.g. this turns [[17]] into 17).
        return cost


      def linear_backward(dZ, cache):
        """
        :param dZ:
        :param cache:
        :return:
        """

        A_prev, W, b = cache
        m = A_prev.shape[1]

        dW = (1. / m) * np.dot(dZ, cache[0].T)
        db = (1. / m) * np.sum(dZ, axis=1, keepdims=True)
        dA_prev = np.dot(cache[1].T, dZ)

        return dA_prev, dW, db


      def linear_activation_backward(dA, cache, activation):
        """
        :param dA:
        :param cache:
        :param activation:
        :return:
        """

        linear_cache, activation_cache = cache

        if activation == "relu":
            dZ = relu_backward(dA, activation_cache)
            dA_prev, dW, db = linear_backward(dZ, linear_cache)

        elif activation == "softmax":
            dZ = softmax_backward(dA, activation_cache)
            dA_prev, dW, db = linear_backward(dZ, linear_cache)

        return dA_prev, dW, db


      def L_model_backward(A_last, Y, caches):
        """
        :param A_last:
        :param Y:
        :param caches:
        :return:
        """

        grads = {}
        L = len(caches)  # the number of layers
        m = A_last.shape[1]
        Y = Y.reshape(A_last.shape)  # after this line, Y is the same shape as A_last

        dA_last = - (np.divide(Y, A_last) - np.divide(1 - Y, 1 - A_last))
        current_cache = caches[-1]
        grads["dA" + str(L)], grads["dW" + str(L)], grads["db" + str(L)] = linear_activation_backward(dA_last,
                                                                                                      current_cache,
                                                                                                      activation="softmax")

        for l in reversed(range(L - 1)):
            current_cache = caches[l]

            dA_prev_temp, dW_temp, db_temp = linear_activation_backward(grads["dA" + str(l + 2)], current_cache,
                                                                        activation="relu")
            grads["dA" + str(l + 1)] = dA_prev_temp
            grads["dW" + str(l + 1)] = dW_temp
            grads["db" + str(l + 1)] = db_temp

        return grads


      def update_params(params, grads, alpha):
        """
        :param params:
        :param grads:
        :param alpha:
        :return:
        """

        L = len(params) // 2  # number of layers in the neural network

        for l in range(L):
            params["W" + str(l + 1)] = params["W" + str(l + 1)] - alpha * grads["dW" + str(l + 1)]
            params["b" + str(l + 1)] = params["b" + str(l + 1)] - alpha * grads["db" + str(l + 1)]

        return params


      def model_DL( X, Y, Y_real, test_x, test_y, layers_dims, alpha, num_iterations, print_cost):  # lr was 0.009
        """
        Implements a L-layer neural network: [LINEAR->RELU]*(L-1)->LINEAR->SIGMOID.
        Arguments:
        X -- data, numpy array of shape (number of examples, num_px * num_px * 3)
        Y -- true "label" vector (containing 0 if cat, 1 if non-cat), of shape (1, number of examples)
        layers_dims -- list containing the input size and each layer size, of length (number of layers + 1).
        alpha -- learning rate of the gradient descent update rule
        num_iterations -- number of iterations of the optimization loop
        print_cost -- if True, it prints the cost every 100 steps
        Returns:
        params -- params learnt by the model. They can then be used to predict.
        """

        np.random.seed(1)
        costs = []  # keep track of cost

        params = initialize_parameters_deep(layers_dims)

        for i in range(0, num_iterations):

            A_last, caches = L_model_forward(X, params)
            cost = compute_cost(A_last, Y)
            grads = L_model_backward(A_last, Y, caches)

            if (i > 800 and i<1700):
                alpha1 = 0.80 * alpha
                params = update_params(params, grads, alpha1)
            elif(i>=1700):
                alpha1 = 0.50 * alpha
                params = update_params(params, grads, alpha1)
            else:
                params = update_params(params, grads, alpha)

            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)
        predictions = predict(params, X)
        print("Train accuracy: {} %", sum(predictions == Y_real) / (float(len(Y_real))) * 100)
        predictions = predict(params, test_x)
        print("Test accuracy: {} %", sum(predictions == test_y) / (float(len(test_y))) * 100)

        #plt.plot(np.squeeze(costs))
        #plt.ylabel('cost')
        #plt.xlabel('iterations (per tens)')
        #plt.title("Learning rate =" + str(alpha))
        #plt.show()

        return params


      def predict(parameters, X):
        A_last, cache = L_model_forward(X, parameters)
        predictions = np.argmax(A_last, axis=0)
        return predictions

      通過攝像頭寫入

      運行程序 python Dig-Rec.py

      python Dig-Rec.py

      通過攝像頭展現傳入的代碼

      運行程序 python Digit-Recognizer.py

      python Digit-Recognizer.py

      Devanagiri Recognizer

      akshaybahadur21/Devanagiri-Recognizer

      Devanagiri-Recognizer - 使用 convnetgithub.com 的印地語字母表分類器

      這段代碼可以幫助你使用 Convnets 來分類不同的印地文字母(Devanagiri)。

      https://github.com/akshaybahadur21/Devanagiri-Recognizer

      你可以為 Python 安裝 Conda,它可以為你提供所有與 Python 有關相關庫的編譯環境。

      使用的技術

      我使用了卷積神經網絡,Tensorflow 框架以及 Keras API 來提供高級的抽象。

      結構

      卷積層 → 池化層 → 卷積層 → 池化層 → 全連接層 →Softmax 回歸層 → 分類

      其他需要注意的事項:

      1. 你還可以增加卷積層。

      2. 增加正則化防止過擬合。

      3. 增加圖片的數量來提高準確率。

      Python 實現

      DHCD (Devnagari Character Dataset)數據集的所有圖片尺寸都是 32 * 32 并且都用于卷積神經網絡。

      運行程序 python Dev-Rec.py

      python Dev-Rec.py

      4. 使用 FaceNet 做面部識別

      akshaybahadur21/ Facial-Recognition-using-FaceNet

      https://github.com/akshaybahadur21/Facial-Recognition-using-Facenet

      這段程序利用 facenet 網絡幫助你做面部識別(https://arxiv.org/pdf/1503.03832.pdf). Facenets 的概念最初是在一篇研究論文中提出的。主要概念討論了三重損失函數來比較不同人的圖像。這個概念使用的是 Inception 網絡,來自于 DeepingLearning.ai社區的 frutils.py 文件。在我的網絡當中我增加了一些函數來提高穩定性和更好的檢測。

      必備的代碼庫

      你可以為 Python 安裝 Conda,它可以為你提供所有與 Python 有關相關庫的編譯環境,以下是你可能需要的庫:

      • numpy

      • matplotlib

      • cv2

      • keras

      • dlib

      • h5py

      • scipy

      描述

      面部識別系統是能夠從數字圖像或者視頻中識別或驗證人面部的技術。構建面部識別系統這里有很多種方法,但是通常,他們是通過比較圖片中選擇的面部特征和數據集中的特征來進行判斷。

      添加的功能

      • 只有當你的眼睛睜開是才能偵測到面部。

      • 使用 dlib 庫的面部對齊功能在實時流媒體上進行有效的預測。

      Python 實現

      • 使用 Inception Network 來搭建網絡

      • 源論文來自于Google-Facenet

      程序

      1. 如果你想訓練網絡,請運行 Train-inception.py, 若你不想訓練網絡,因為我早已經訓練好了一個網絡,那么你可以下載該文件到本地運行 face-rec_Google.h5 。

      2. 現在你已經有了一個數據集,里面包含了很多圖片。 點擊文件 /images來折疊這些照片。您可以將圖片粘貼到此處,也可以使用網絡攝像頭進行點擊。你可以運行該文件 create-face.py 來做到這一點,圖片都存儲在文件夾 /incept 中。你必須手動粘貼到文件夾中 /images folder。

      3. 運行程序 rec-feat.py 來實現所有的功能。

      5. Emojinator

      akshaybahadur21/ Emojinator

      Emojinator -  Github 上一個簡單的表情分類器。

      https://github.com/akshaybahadur21/Emojinator

      這些代碼能夠幫助你區分不同的表情。到目前為止,我們只支持手的表情。

      必備的代碼庫

      你可以為 Python 安裝 Conda,它可以為你提供所有與 Python 有關相關庫的編譯環境,以下是你可能需要的庫:

      • numpy

      • matplotlib

      • cv2

      • keras

      • dlib

      • h5py

      • scipy

      描述

      表情符號是電子信息和網頁中使用的表意符號和微笑符號。表情符號存在于不同的類型中,包括面部表情、常見物體、地點和天氣類型以及動物。它們很像表情符號,但表情符號是真實的圖片,而不是印刷圖。

      功能

      1. 利用過濾器來檢測手。

      2. 利用 CNN 來訓練模型。

      Python 實現

      使用卷積神經網絡

      過程

      1. 首先,你需要一個手勢圖片的數據庫,你可以運行該文件來獲得  CreateGest.py。輸入手勢名稱,你可以看到兩個框架。按「C」進行拍攝??纯摧喞蚣懿⒄{整你的手,以確保你捕捉到你的手的特征。一個手勢可以拍 1200 張照片。試著在框架內移動你的手,以確保你的模型在訓練過程當中不會過擬合。

      2. 重復以上操作,保證你可以獲得所有你想要的特征。

      3. 運行程序 CreateCSV.py 來將圖片轉換成 CSV 文件。

      4. 如果你想訓練模型,則運行程序 『TrainEmojinator.py』

      5. 最后,運行程序 Emojinator.py ,通過攝像頭來測試你的模型

      作者

      Akshay Bahadur 和 Raghav Patnecha.

      結語

      我只能說我對這些項目感到難以置信,所有人都可以在計算機上運行它們,或者在 Deep Cognition 的平臺上運行它們,如果你不想安裝任何東西,它可以在線運行。

      我想感謝 Akshay 和他的朋友們為開放源代碼貢獻力量以及所有其他將來的貢獻。嘗試一下,運行它們,并獲得靈感。這只是 DL 和 CV 可以做的令人驚嘆的事情的一個小例子,取決于你如何將它變成可以幫助世界變得更好的地方。  

      永不放棄,我們需要每個人都對許多不同的事情感興趣。我認為我們可以改善世界,改善我們的生活,我們的工作方式,思考和解決問題,如果我們引導現在的所有資源,使這些知識領域共同努力,實現更大的利益,我們可以在世界和我們的生活中產生巨大的積極影響。

      我們需要更多的人感興趣,更多課程,更專業化,更熱情。我們需要你:)

      感謝您閱讀到這,希望您可以在這里發現更多有意思的是:)

      如果你有任何問題,請在 Twitter 和 LinkedIn 上聯系我:

      • Twitter

        Favio Vázquez (@FavioVaz) 

      • LinkedIn:

        Favio Vázquez?—?Principal Data Scientist?—?OXXO | LinkedIn

      機器學習開發者應該收藏的 DIY 計算機視覺和深度學習項目

      雷峰網原創文章,未經授權禁止轉載。詳情見轉載須知

      機器學習開發者應該收藏的 DIY 計算機視覺和深度學習項目

      分享:
      相關文章

      知情人士

      AI研習社(yanxishe.com)譯站頻道,傳播前沿人工智能知識,讓語言不再成為學習知識的門檻。(原雷鋒字幕組)
      當月熱門文章
      最新文章
      請填寫申請人資料
      姓名
      電話
      郵箱
      微信號
      作品鏈接
      個人簡介
      為了您的賬戶安全,請驗證郵箱
      您的郵箱還未驗證,完成可獲20積分喲!
      請驗證您的郵箱
      立即驗證
      完善賬號信息
      您的賬號已經綁定,現在您可以設置密碼以方便用郵箱登錄
      立即設置 以后再說
      主站蜘蛛池模板: a国产精品| 欧美变态口味重另类在线视频| 丁香婷婷五月| 黄网免费观看| 亚洲乱亚洲乱妇在线| 99久久99久久精品免费看蜜桃| 亚洲精品字幕| 漂亮的保姆hd完整版免费韩国| 简阳市| 在线观看成人永久免费网站| 精品久久国产字幕高潮| 97人妻免费碰视频碰免| 精久视频| 樱花草在线社区www| 久久av无码精品人妻糸列| 99精品成人| 日本久久久久| 老司机午夜精品视频资源| 国产亚洲视频免费播放| 色综合久久一区二区三区| 欧韩一区| AV天堂中文字幕| 天天躁日日躁狠狠躁中文字幕| 一区二区久久不射av| av无码免费一区二区三区| 亚洲天堂男人| 噜噜噜综合亚洲| 精品久久久久久亚洲中文字幕| 淮阳县| 国产精品久久久久久av| 国产午夜一区二区在线观看| 亚洲美女高潮久久久久久久| 97精品伊人久久久大香线蕉| 1024国产基地| 99精品国产一区二区三区2021| 久久久一本精品99久久精品66直播| 欧美日韩综合在线精品| 国产一区二区波多野结衣| 亚洲成人无码在线观看| 国产ts| 巴东县|