Giter VIP home page Giter VIP logo

project-nextlab-cnn-efficientnet's Introduction

NEXTLab Car Detection Project

Example

Open In Colab

Main Contributers

  • Jeongtae Shin(@Klassikcat): Project Management, Model build, Engineering
  • Jaewoong Lee(@colin19950703): Augmentation, model build, Enigeering
  • Hongkyun Kim(@ghdrbs0302): Data Inspection, Test data Labeling, Engineering

Installation

!pip install -U git+https://github.com/Klassikcat/project-NEXTLab-CNN-EfficientNet

pre-trained Weights

https://drive.google.com/file/d/1UyVnR5Pi7NvzD3LPnkllGEyn8afMi5jF/view?usp=sharing

Structure

project-NEXTLabcoreconfig.py               # Tensorflow Configurationutils.pymodelEfficientNet.py         # Model block and builderinitializers.py         # from EfficientNetv2 (https://arxiv.org/abs/2104.00298)layer.py                # from EfficietnNetv2model.py                # from EfficientNetv2params.py               # from EfficientNetv2utilsaugmentation            # Data augmentation toolsaugmentation.pylauncher_augment.pylauncher_classname.pyfrom_folderloader.py             # get train/valid/test dataset from directorytfrecordtfrecordMaker         # Make TFRecordtfrecordViewer        # Visualize, Load TFRecord unicodeUtil.py          # Korean utilities assemble jamovisuialization.py       # Plots(data distribution, heatmap)
setup.py                    # installer
readme.md

Stack

Python TensorFlow sklearn

Objective

  • Making EfficientNetv2 application that distinguish 322 cars by using photos captured by traffic camera
  • Traffic enforcement, Parking lot management.

Data

Train/Validatation Data

  • Uses modified "자동차 차종/연식/번호판 인식용 영상" from AIHub: https://aihub.or.kr/aidata/27727
  • Uses 522 classes in "세단", "SUB", "해치백", "승합"

Test Data

Data Distribution

approximately 82% of data is korean cars(hyundai, KIA)

approximately 75% of data is korean cars(sonata, etc...)

51% sedan, 28.8% SUV, 10% Hatchback, 9% van

mainly consists with 2010~2018 cars

Data Augmentation

  • use these augmentations taking the possible road situations into account.
  • Drop the class with less than 30 pieces of data in order to avoid data leakage
  • randomly pick 300 data. if the class has less than 30 data, proceed Data Augmentation for equal distribution of data

Model Structure

  • EfficientNetB0(224, 224) with 30 layer freeze

Train_validation accuracy/loss

top 1 accuracy/loss

  • train: 0.9051/0.2755
  • valid: 0.8960/0.3769

top 3 accuracy

  • train: 0.9880
  • valid: 0.9717

Further Work

[ ] Increase valid/test accuracy by making Ensemble model

[ ] Label Smoothing

[ ] Fix all false label

project-nextlab-cnn-efficientnet's People

Contributors

colin19950703 avatar klassikcat avatar

Watchers

 avatar

project-nextlab-cnn-efficientnet's Issues

Yolo_v4 Colab에서 실행 시 detect_image(img_path) 실행 에러

아직 욜로를 실행을 못하는 중입니다...

  1. 재웅님이 공유해준 yolo.zip 파일을 코랩에 압축을 풀어서 코드를 실행하고 아래 이미지 코드를 실행했습니다. (경로만 수정해줬습니다)

img_path = '/content/data/road.mp4'
detect_video(img_path)
print("Done!!")

  1. 실행 시 발생한 에러는 다음과 같습니다.

[에러코드]
DisabledFunctionError: cv2.imshow() is disabled in Colab, because it causes Jupyter sessions
to crash; see jupyter/notebook#3935.
As a substitution, consider using
from google.colab.patches import cv2_imshow

  1. from google.colab.patches import cv2_imshow <-- 코드를 추가하여서 런타임 다시 실행하여 코드를 실행해봤을 때도 똑같은 에러가 발생했습니다.

from google.colab.patches import cv2_imshow
img_path = '/content/data/road.mp4'
detect_video(img_path)
print("Done!!")

  1. 혹시나 detect_video를 실행하지 않고 이미지만 불러오려고 아래 코드를 실행했습니다.

img_path = '/content/data/road_kor.jpg'
cv2_imshow(img_path)

[에러코드]
AttributeError Traceback (most recent call last)
in ()
1 from google.colab.patches import cv2_imshow
2 img_path = '/content/data/road_kor.jpg'
----> 3 cv2_imshow(img_path)

/usr/local/lib/python3.7/dist-packages/google/colab/patches/init.py in cv2_imshow(a)
20 image.
21 """
---> 22 a = a.clip(0, 255).astype('uint8')
23 # cv2 stores colors as BGR; convert to RGB
24 if a.ndim == 3:

AttributeError: 'str' object has no attribute 'clip'

  1. 위의 에러코드 23번을 보면 'cv2 stores colors as BGR; convert to RGB' 라는걸 확인해서 혹시나 하는 생각으로 detect_video 함수에 있는 40번줄에 있는 코드를
    result = cv2.cvtColor(np.array(result), cv2.COLOR_RGB2BGR) 에서 컬러 수정해주는거를
    result = cv2.cvtColor(np.array(result), cv2.COLOR_BGR2RGB) 로 수정해봤지만 이 또한 4번에 적어둔 에러코드와 똑같은게 뜹니다.

cv2 버전을 확인했는데
'4.1.2' 버전입니다

마지막 첨부사진은 현재 제 경로입니다.
image

[Yolo v4 issue :: 모델이 1회용이 된 거 같습니다]

https://drive.google.com/file/d/1PEMV7wxIcqM3uGw3wbX8FUOQLrIOluxQ/view?usp=sharing

1.위의 링크로 들어가 용량문제로 첨부되지 못한 데이터, pre-train weight, 모델을 다운받아주세요.

2.압축을 풀고 YOLO-v4 폴더에 넣어주세요
아래와 같이 구성되어야합니다.
YOLO-v4
└checkpoints
| core
| data
| yolov4-416
| Yolo_v4.ipynb

[ issue]

주피터 노트북으로 main문(object detection부분)을 실행후 또 다시 main문을 호출하게 되면 objectdetection이 실행되지 않습니다.
이때 load model 블럭을 호출하고 다시 main문을 실행하게 되면 정상적으로 작동합니다.
무슨 모델이 1회만 사용하고 동작하지 않는 것 같습니다.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.