GithubHelp home page GithubHelp logo

sanchit2843 / videoclassification Goto Github PK

View Code? Open in Web Editor NEW
79.0 3.0 18.0 106 KB

Crime detection in cctv footage using deep learning

Jupyter Notebook 85.31% Python 14.69%
pytorch action-recognition deep-learning cnn-classification crime-data crime-prediction

videoclassification's Introduction

I have implemented crime recognitions from cctv footages using UCF-crime dataset which can be obtained from here. The dataset being too big I downloaded shorter version of it available on kaggle. This shorter version consists of 8 classes which includes Abuse, arrest, arson, assault, burglary, explosion, fighting and normal.

Datapreprocessing

I converted videos into frames and took only 16 frames from every video for the training of model. These 16 frames were selected from complete video sequence by skipping frames according to video length. In this dataset the number of videos are less but longer so to increase number of samples by 10 times I took 16 samples where first frame started from 0-9 thus giving 10 times the number of videos and all with different images. To speed up the transfer of data I combined these 16 images into 1. The implementation of the preprocessing can be found in videodata.ipynb. The preprocessed data with 16 samples can be found here.

Model used

This task is of action recognition and I tried one of the best model for action recognition Slow Fast Networks for Video Recognition worked best. The implementation of this network in pytorch can be found here.

Training

The model trained fast and reached a training accuracy of 99% within 20 epochs.

videoclassification's People

Contributors

sanchit2843 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

videoclassification's Issues

TrainData

iam using cuda with single gpu , first i did the same like you and that error show up

--- Epoch 0 ---

--- Phase train ---

BrokenPipeError Traceback (most recent call last)
~\AppData\Local\Temp/ipykernel_7520/1387622654.py in
14 print(f"--- Phase {phase} ---")
15 epoch_metrics = {"loss": [], "acc": []}
---> 16 for batch_i, (X, y) in enumerate(dataloaders[phase]):
17 print()
18 #iteration = iteration+1

~\AppData\Local\Programs\Python\Python37\lib\site-packages\torch\utils\data\dataloader.py in iter(self)
357 return self._iterator
358 else:
--> 359 return self._get_iterator()
360
361 @Property

~\AppData\Local\Programs\Python\Python37\lib\site-packages\torch\utils\data\dataloader.py in _get_iterator(self)
303 else:
304 self.check_worker_number_rationality()
--> 305 return _MultiProcessingDataLoaderIter(self)
306
307 @Property

~\AppData\Local\Programs\Python\Python37\lib\site-packages\torch\utils\data\dataloader.py in init(self, loader)
916 # before it starts, and del tries to join but will get:
917 # AssertionError: can only join a started process.
--> 918 w.start()
919 self._index_queues.append(index_queue)
920 self._workers.append(w)

~\AppData\Local\Programs\Python\Python37\lib\multiprocessing\process.py in start(self)
110 'daemonic processes are not allowed to have children'
111 _cleanup()
--> 112 self._popen = self._Popen(self)
113 self._sentinel = self._popen.sentinel
114 # Avoid a refcycle if the target function holds an indirect

~\AppData\Local\Programs\Python\Python37\lib\multiprocessing\context.py in _Popen(process_obj)
221 @staticmethod
222 def _Popen(process_obj):
--> 223 return _default_context.get_context().Process._Popen(process_obj)
224
225 class DefaultContext(BaseContext):

~\AppData\Local\Programs\Python\Python37\lib\multiprocessing\context.py in _Popen(process_obj)
320 def _Popen(process_obj):
321 from .popen_spawn_win32 import Popen
--> 322 return Popen(process_obj)
323
324 class SpawnContext(BaseContext):

~\AppData\Local\Programs\Python\Python37\lib\multiprocessing\popen_spawn_win32.py in init(self, process_obj)
63 try:
64 reduction.dump(prep_data, to_child)
---> 65 reduction.dump(process_obj, to_child)
66 finally:
67 set_spawning_popen(None)

~\AppData\Local\Programs\Python\Python37\lib\multiprocessing\reduction.py in dump(obj, file, protocol)
58 def dump(obj, file, protocol=None):
59 '''Replacement for pickle.dump() using ForkingPickler.'''
---> 60 ForkingPickler(file, protocol).dump(obj)
61
62 #

BrokenPipeError: [Errno 32] Broken pipe

Then i have removerd Num_worker = 4 from train_loader and this error show up , can u please help me ?

--- Epoch 0 ---

--- Phase train ---

TypeError Traceback (most recent call last)
~\AppData\Local\Temp/ipykernel_7520/1651256458.py in
14 print(f"--- Phase {phase} ---")
15 epoch_metrics = {"loss": [], "acc": []}
---> 16 for batch_i, (X, y) in enumerate(dataloaders[phase]):
17 print("available")
18 #iteration = iteration+1

~\AppData\Local\Programs\Python\Python37\lib\site-packages\torch\utils\data\dataloader.py in next(self)
519 if self._sampler_iter is None:
520 self._reset()
--> 521 data = self._next_data()
522 self._num_yielded += 1
523 if self._dataset_kind == _DatasetKind.Iterable and \

~\AppData\Local\Programs\Python\Python37\lib\site-packages\torch\utils\data\dataloader.py in _next_data(self)
559 def _next_data(self):
560 index = self._next_index() # may raise StopIteration
--> 561 data = self._dataset_fetcher.fetch(index) # may raise StopIteration
562 if self._pin_memory:
563 data = _utils.pin_memory.pin_memory(data)

~\AppData\Local\Programs\Python\Python37\lib\site-packages\torch\utils\data_utils\fetch.py in fetch(self, possibly_batched_index)
42 def fetch(self, possibly_batched_index):
43 if self.auto_collation:
---> 44 data = [self.dataset[idx] for idx in possibly_batched_index]
45 else:
46 data = self.dataset[possibly_batched_index]

~\AppData\Local\Programs\Python\Python37\lib\site-packages\torch\utils\data_utils\fetch.py in (.0)
42 def fetch(self, possibly_batched_index):
43 if self.auto_collation:
---> 44 data = [self.dataset[idx] for idx in possibly_batched_index]
45 else:
46 data = self.dataset[possibly_batched_index]

~\AppData\Local\Temp/ipykernel_7520/3273416116.py in getitem(self, idx)
11 seq_img = list()
12 for i in range(16):
---> 13 img1 = img[:,128i:128(i+1),:]
14 if(self.transform):
15 img1 = self.transform(img1)

TypeError: 'NoneType' object is not subscriptable

Pretrained Model

The link to the pretrained model is still broken. Can you please update that

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.