From 217e8153e8dead21707b5639eb53ce7a79ac7711 Mon Sep 17 00:00:00 2001 From: yjyjy131 Date: Wed, 22 Jun 2022 23:20:57 +0900 Subject: [PATCH] data prefecther issue out of memory --- README.md | 18 +++++++++++++++++- SPFCN/__init__.py | 6 +++--- SPFCN/dataset/__init__.py | 24 +++++++++++++----------- 3 files changed, 33 insertions(+), 15 deletions(-) diff --git a/README.md b/README.md index e92b91e..60ad1fc 100644 --- a/README.md +++ b/README.md @@ -14,7 +14,23 @@ Paper link: https://arxiv.org/abs/2003.11337 For vehicles equipped with the automatic parking system, the accuracy and speed of the parking slot detection are crucial. But the high accuracy is obtained at the price of low speed or expensive computation equipment, which are sensitive for many car manufacturers. In this paper, we proposed a detector using CNN(convolutional neural networks) for faster speed and smaller model size while keeps accuracy. To achieve the optimal balance, we developed a strategy to select the best receptive fields and prune the redundant channels automatically after each training epoch. The proposed model is capable of jointly detecting corners and line features of parking slots while running efficiently in real time on average processors. The model has a frame rate of about 30 FPS on a 2.3 GHz CPU core, yielding parking slot corner localization error of 1.51±2.14 cm (std. err.) and slot detection accuracy of 98%, generally satisfying the requirements in both speed and accuracy on onboard mobile terminals. ## Usage -Detailed instructions will be given soon. + + + +1. 데이터 셋 구성 +./data/train/ +./data/train_raw_label/ +./data/test/all/ +./data/test/test_raw_label/ + + + + + + + + + ## Performance The training and test data set is https://cslinzhang.github.io/deepps/ diff --git a/SPFCN/__init__.py b/SPFCN/__init__.py index 6057e37..c5c462c 100644 --- a/SPFCN/__init__.py +++ b/SPFCN/__init__.py @@ -13,18 +13,18 @@ def setup(seed): cudnn.deterministic = True -def slot_network_training(device_id=1): +def slot_network_training(device_id=0): # Initial setup(19960229) net = SlotNetwork([32, 44, 64, 92, 128], device_id=device_id) # Train - auto_train(get_training_set(6535, 50, 224, device_id), net, device_id=device_id, + auto_train(get_training_set(6535, 12, 224, device_id), net, device_id=device_id, epoch_limit=1000, save_path="parameters/") # TODO -def slot_network_testing(model_path, device_id=1): +def slot_network_testing(model_path, device_id=0): # Initial setup(19960229) diff --git a/SPFCN/dataset/__init__.py b/SPFCN/dataset/__init__.py index e1cdba1..59e47d6 100644 --- a/SPFCN/dataset/__init__.py +++ b/SPFCN/dataset/__init__.py @@ -12,15 +12,17 @@ def get_training_set(data_size: int, assert 0 < data_size < 6596 and 0 < batch_size and 0 < resolution vps_set = VisionParkingSlotDataset( - image_path="/data/training/", - label_path="/data/training_raw_label/", + image_path="./data/training/image/", + label_path="./data/training/label/", data_size=data_size, resolution=resolution) - if device_id < 0: - return DataLoader(dataset=vps_set, shuffle=True, batch_size=batch_size, num_workers=4) - else: - return DataPrefetcher(device=torch.device('cuda:%d' % device_id), - dataset=vps_set, batch_size=batch_size, shuffle=True) + + return DataLoader(dataset=vps_set, shuffle=True, batch_size=batch_size, num_workers=4) + # if device_id < 0: + # return DataLoader(dataset=vps_set, shuffle=True, batch_size=batch_size, num_workers=4) + # else: + # return DataPrefetcher(device=torch.device('cuda:%d' % device_id), + # dataset=vps_set, batch_size=batch_size, shuffle=True) def get_validating_set(data_size: int, @@ -29,8 +31,8 @@ def get_validating_set(data_size: int, device_id: int = 0): assert 0 < data_size < 1538 and 0 < batch_size and 0 < resolution vps_set = VisionParkingSlotDataset( - image_path="/data/testing/all/all/", - label_path="/data/testing/all/raw_label/", + image_path="./data/testing/image/", + label_path="./data/testing/label/", data_size=data_size, resolution=resolution) if device_id < 0: @@ -47,8 +49,8 @@ def get_testing_set(data_size: int, device_id: int = 0): assert 0 < data_size < 1538 and 0 < batch_size and 0 < resolution vps_set = VisionParkingSlotDataset( - image_path="/data/testing/all/all/", - label_path="/data/testing/all/raw_label/", + image_path="./data/testing/image/", + label_path="./data/testing/label/", data_size=data_size, resolution=resolution) if device_id < 0: