I was wondering if it is possible to run densepose annotations on a mp4 with detectron2?
In the projects folder, you can run densepose with applynet.py but this only works on images. I tried running this commmand
d demo/
python demo.py --config-file ../configs/COCO-InstanceSegmentation/mask_rcnn_R_50_FPN_3x.yaml \
--video-input video.mp4 \
[--other-options]
--opts MODEL.WEIGHTS detectron2://COCO-InstanceSegmentation/mask_rcnn_R_50_FPN_3x/137849600/model_final_f10217.pkl
with densepose weights and annotations but Detectron2 gives me this error:
Non-existent config key: MODEL.DENSEPOSE_ON
I know DensePose video exists but it is out of date as it uses caffe2 separated from pytorch.
Is this possible or can you not run on video?
Easiest approach is to use something like ffmpeg to split your video into frames, and then run detectron2 on each frame.
Related
Currently I am working a project that has have been using the pathlib library so I can work on my Windows desktop when I need too and on my MacBook Pro. Essentially be able to work between both operating systems. I have not have any issues at all until right now. Here is the set up:
I have a pipeline set up to automatically save a .joblib and a whole lot of .png files that will go to a directory called
output_dir = Path('../Trained_Models/Differential_gene_analysis/A Kidney Cancer Transcriptome Molecular Signature Identifies Tumors with Tumor Thrombus/Models train on TCGA data and test on Rodriguez data/Oct-XX-20XX')
For example, if I want to save a .joblib file under the name RandomForest_TumorThrombus_104.joblib,I would use the command
joblib.dump(model ,output_dir / 'RandomForest_TumorThrombus_104.joblib')
On my MacBook Pro, I have no issues when this is ran, but on Windows it gives me the following error
FileNotFoundError: [Errno 2] No such file or directory: '..\\Trained_Models\\Differential_gene_analysis\\A Kidney Cancer Transcriptome Molecular Signature Identifies Tumors with Tumor Thrombus\\Models train on TCGA data and test on Rodriguez data\\Oct-17-2022\\RandomForest_TumorThrombus_104.joblib'
I have tried to use the .resolve() method to get the absolute path but still gives me the same error. I have tried to experiment to try to see what is goin on such as using os.path.exists(). When using the os.path.exists() method I get True for the follwoing command:
os.path.exists(output_dir)
So it does indeed recognize that the directory exists. The next thing I tried was to rename the file to something like dddddd.joblib and that worked. But I find that only a few names for the file would allow me to save the files. During debug I found that the most recent Traceback occurs here:
with open(filename, 'wb') as f:```
I was wondering if anyone here had any idea what was going on here and how I can fix this issue? Please and Thank you.
The solution was to enable long paths on Windows.
I've recently started to work on a project with SRTM datas and I've extracted pbf file using phyghtmap.
To start I'm getting hgt files, converting them to tif using the following command : gdal_fillnodata.py data.hgt data.tif
Then I'm warping them with gdalwarp -co BIGTIFF=YES -co TILED=YES -co COMPRESS=LZW -co PREDICTOR=2 -t_srs "+proj=merc +ellps=sphere +R=6378137 +a=6378137 +units=m" -r bilinear -tr 90 90 data.tif warp-90.tif
And finally creating the pbf file with phyghtmap --max-nodes-per-tile=0 -s 10 -0 --pbf warp-90.tif
The results is a list of pbf files. They are perfectly fine when I load them into PostGIS with osm2pgsql. But I want to merge them to fasten the import.
I've tried all the major solutions:
osmium merge *.pbf -o merged.pbf
convert pbf to o5m then osmconvert64 *.o5m -o=merge.o5m then convert back to pbf
merging two by two with osmosis --read-pbf lon4.00_5.00lat44.00_45.00_local-source.pbf --read-pbf lon5.00_6.00lat44.00_45.00_local-source.osm.pbf --merge --write-pbf osmo_merge.osm.pbf
None of them worked and the result is only a very small fraction of the data merged in the result file.
Am I doing something wrong?
Note: If I load all pbf with --append it works, but it take ages for a very small portion of the world.
I found the issue. I wasn't setting the --start-node-id and --start-way-id in my script so all my pbf was using the same id range. Now I'm assigning unique ID and it work like a charm :)
I am trying to extract images in CentOS machine using ImageMagick's convert command as below:
convert -coalesce http://cdn.abcdf.com/p/f7/81/d3/40/f781d34031e68828eaasdwc937cf3f8.gif /mnt/temp/123.png
I am getting the following error:
convert: unable to open image `//cdn.adnxs.com/p/f7/81/d3/40/f781d34031e6882840eaa6dc937cf3f8.gif': No such file or directory # error/blob.c/OpenBlob/2701.
convert: no decode delegate for this image format `HTTP' # error/constitute.c/ReadImage/504.
convert: no images defined `/mnt/ephemeral2/creative_report/temp/123.png' # error/convert.c/ConvertImageCommand/3258
I tried reinstalling ImageMagick from source but it was of no use.
I resolved the issue by reinstalling IM and the missing libxml2-devel library. Below are the steps I followed:
1)cd (ImageMagick folder)
2)make uninstall
3)yum install tcl-devel libpng-devel libjpeg-devel ghostscript-devel bzip2-devel freetype-devel libtiff-devel libxml2-devel
4)wget ftp://ftp.imagemagick.org/pub/ImageMagick/ImageMagick-6.9.9-0.tar.gz
5)tar xvfz ImageMagick-6.9.9-0.tar.gz
6)cd (the folder created)
7)./configure --prefix=/usr/local --with-bzlib=yes --with-fontconfig=yes --with-freetype=yes --with-gslib=yes --with-gvc=yes --with-jpeg=yes --with-jp2=yes --with-png=yes --with-tiff=yes
8)make clean
9)make
10)make install
On windows I would put double quotes around the path as it looks like it is breaking up the image path.
Your link is bad. My browser tells me it cannot find the server. In ImageMagick, you should read the input image first. So if you fix your URL, then
convert http://cdn.abcdf.com/p/f7/81/d3/40/f781d34031e68828eaasdwc937cf3f8.gif -coalesce /mnt/temp/123.png
ffmpeg -i /home/mysite/public_html/videos/thankyou/thankyou_1.mp4 -strict -2 -vf
"[in]drawtext=fontfile=/home/mysite/fonts/OswaldFont/Oswald-Bold.ttf: x=450:
y=150: fontsize=152: fontcolor=0xAE0216#1: draw='if(gt(n,40),lt(n,300))':
text='THANK YOU',drawtext=fontfile=/home/mysite/fonts/OswaldFont/Oswald-Bold.ttf:
x=450: y=320: fontsize=200: fontcolor=0xAE0216#1: draw='if(gt(n,50),lt(n,300))':
text='JAMISON'" /home/mysite/public_html/videos/thankyou_2.mp4
When running the above, I'm getting the following. It seems to run properly on other distributions. Not sure where to check next.
[Parsed_drawtext_0 # 0x2835480] Option 'draw' not found
[AVFilterGraph # 0x283f980] Error initializing filter 'drawtext' with args 'fontfile=/home/mysite/fonts/OswaldFont/Oswald-Bold.ttf: x=450: y=150: fontsize=152: fontcolor=0xAE0216#1: draw=if(gt(n,40),lt(n,300)): text=THANK YOU'
Error opening filters!
Additionally, this original command works fine in Ubuntu, but give the seen error when running in centOS.
According the the FFmpeg drawtext filter documentation:
draw
This option does not exist, please see the timeline system
This means you should use timeline editing instead.
To do that replace the draw='...' part of your command with:
enable=if(gt(n\,50)\,lt(n\,300))
You should also check:
FFmpeg versions on each machine. You might have an older version installed on Ubuntu, which supports the draw option, and a newer version on CentOS in which the option was removed.
if the font files exist
Does anyone know how to extract teletext subtitles?
I have tried ffmpeg, it says
Invalid frame dimensions 0x0
CCExtractor, it says
"Missing ASF header. Abort
telxcc, it says
! Invalid TS packet header; TS seems to be misaligned
I have done a lot of research, but have no luck. Can anyone offer some help!
dvb_subtitles cannot be extracted with ffmpeg easily because is an image that overlays the original. Good explanation: https://stackoverflow.com/a/20887655/2119685
There is a way to extract the dvb_teletext, which normally includes the subtiltes too.
Install the next dependency:
sudo apt-get install libzvbi-dev
Then recompile from source ffmpeg with:
--enable-libzvbi
Good tutorial here on how to compile FFMPEG from source -https://trac.ffmpeg.org/wiki/CompilationGuide/Ubuntu
Then execute the next command to fetch the subtitles to a .srt file:
ffmpeg -txt_format text -i INPUT1 -an -vn -scodec srt test.srt
And voila, your .srt subtitles will be in test.srt
Did you try using gstreamer ? appsrc->tsdemux->fakesink. Make pipeline like this, and then get the PES data from fakesink callback.