This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from google.colab import drive | |
drive.mount('/content/drive', force_remount=True) | |
# Importing all necessary libraries | |
import cv2 | |
import os | |
# Read the video from specified path | |
cam = cv2.VideoCapture("Video/Path/h.mp4") #Video path |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from sklearn.model_selection import train_test_split | |
import numpy as np | |
a = ["1", "3", "4", "1", "3", "4"] | |
b = [[2, 4, 3],[0, 4, 5], [8, 9, 5], [5, 4, 5],[8, 4, 5], [2, 9, 5]] | |
y_train = np.array(a) | |
x_train = np.array(b) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Pretty good solution. One can resize a video as: | |
ffmpeg -i AigCblw--hk_000067_000077.mp4 -vf "scale='if(gt(ih,iw),256,trunc(oh*a/2)*2):if(gt(ih,iw),trunc(ow/a/2)*2,256)'" output.mp4 | |
For multiple videos, one can perform (please mkdir a videos_resized folder in prepath ../): | |
for f in *.mp4 ; do ffmpeg -i "$f" -vf "scale='if(gt(ih,iw),256,trunc(oh*a/2)*2):if(gt(ih,iw),trunc(ow/a/2)*2,256)'" "../videos_resized/$f" ; done |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Try to find max in list: | |
l = [1,2,3,4,4] | |
num = max(l, key=lambda x:l.count(x)) # num will be 4 | |
the you can get the count of num. | |
l.count(num) # this wil returns 2 | |
in the other hand as @buddemat said(Here), it is better to: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
To reduce the size of your mp4 you have two good choices with FFmpeg: | |
Experiment with Constant Rate Factor (CRF) settings to find a match between video output size and video quality | |
Experiment with the set bitrate of your choice and use a 2 pass encode. | |
Details of both below: | |
1. Resize using FFmpeg's Constant Rate Factor (CRF) option: | |
In FFmpeg the CRF settings vary from 0-51 with 0 being lossless and 51 being shockingly poor quality. The default is 23 and you need to find the 'sweet spot' for your particular video of file size and video quality with some experimentation. |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
import pandas as pd | |
eps = np.finfo(float).eps | |
from numpy import log2 as log | |
dataset = {'Taste':['Salty','Spicy','Spicy','Spicy','Spicy','Sweet','Salty','Sweet','Spicy','Salty'], | |
'Temperature':['Hot','Hot','Hot','Cold','Hot','Cold','Cold','Hot','Cold','Hot'], | |
'Texture':['Soft','Soft','Hard','Hard','Hard','Soft','Soft','Soft','Soft','Hard'], | |
'Eat':['No','No','Yes','No','Yes','Yes','No','Yes','Yes','Yes']} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import tensorflow as tf | |
import numpy as np | |
import matplotlib.pyplot as plt | |
#%matplotlib inline | |
from tensorflow.keras.datasets import fashion_mnist | |
#(x_train, _), (x_test, _) = fashion_mnist.load_data() | |
import os |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Writer: Md Shamimul Islam | |
import cv2 | |
import numpy as np | |
import os | |
from matplotlib import pyplot as plt | |
import time | |
import mediapipe as mp | |
import glob |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Create a new repository on GitHub. You can also add a gitignore file, a readme and a licence if you want | |
Open Git Bash | |
Change the current working directory to your local project. | |
Initialize the local directory as a Git repository. | |
git init | |
Add the files in your new local repository. This stages them for the first commit. | |
git add . | |
Commit the files that you’ve staged in your local repository. | |
git commit -m "initial commit" | |
Copy the https url of your newly created repo |
NewerOlder